2013-08-04 77 views
5

我不能讓咕嚕能在Windows 7在所有的工作之後我已經運行繁重的網站(http://gruntjs.com/getting-started)上的說明:」致命錯誤:無法找到本地咕嚕聲。「在Windows 7

npm uninstall -g grunt-cli 
npm uninstall grunt 
npm uninstall -g grunt-init 

git clone [email protected]:gruntjs/grunt-init-jquery.git c:/Users/me/.grunt-init/jquery 

npm install -g grunt-cli 
grunt-init jquery 
npm install . 

之後,運行「咕嚕」產生下面的輸出:

grunt-cli: The grunt command line interface. (v0.1.9) 

Fatal error: Unable to find local grunt. 

If you're seeing this message, either a Gruntfile wasn't found or grunt 
hasn't been installed locally to your project. For more information about 
installing and configuring grunt, please see the Getting Started guide: 

http://gruntjs.com/getting-started 

NPM列表咕嚕的輸出是:

npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] 'repositories' (plural) Not supported. 
npm WARN package.json Please pick one as the 'repository' field 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No repository field. 
C:\Users\me\AppData\Roaming\npm 
└─┬ [email protected] 
    └── [email protected] 

運行 「故宮安裝咕嚕」 在當前目錄GI運行grunt時會出現同樣的錯誤。

有什麼想法?我的理解是,grunt-cli是爲了尋找一個本地的grunt安裝,但我找不出爲什麼找不到它。

+0

http://stackoverflow.com/questions/13925916/fatal-error-unable-to-find-local-grunt/嘗試13927654#13927654,這可能有所幫助。 – Anshul

+0

你需要一個本地的grunt實例。看到這裏:http:// stackoverflow。com/a/27115342/687677 – superluminary

回答

5

我知道自從問了這個問題之後已經有2年了。但是如果有人想在將來:

我得到了完全相同的問題。我通過在本地安裝grunt 得到了這個固定。按照咕嚕site

Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.

所以我剛剛纔通過本地安裝咕嚕工作。

npm install grunt --save-dev 

--save:將它添加到您的package.json。

-dev:將其添加爲開發依賴項。

3

在您運行命令的目錄中必須有一個Gruntfile.js文件。再仔細檢查'npm install grunt'是否給你一個名爲grunt的子目錄的node_modules目錄。

1

您應該在GUI模式下安裝grunt

打開node.js命令提示符,然後打開根文件夾,然後運行下面的命令

  1. npm install(一旦完成它,你可以看到在根文件夾node_modules文件夾)

  2. npm install –g grunt-cli(其他城市版本從("version": "minified"Current release("version":"1.11");您應該在您運行構建時更換爲縮小版)

  3. grunt build:full

注:版本已經運行grunt首次何時改變。

0

如果以上答案不工作,那麼你可以使用此

rm -rf node_modules/ && npm cache clean && npm install 
相關問題