2016-04-15 176 views
1

我已經安裝了咕嚕:無法安裝Grunt?

sudo npm install -g grunt-cli 
/Users/user/.nvm/versions/node/v4.3.0/bin/grunt -> /Users/user/.nvm/versions/node/v4.3.0/lib/node_modules/grunt-cli/bin/grunt 
/Users/user/.nvm/versions/node/v4.3.0/lib 
└── [email protected] 

但是當我運行的呼嚕聲,我有錯誤:

grunt 
grunt-cli: The grunt command line interface (v1.2.0) 

Fatal error: Unable to find local grunt. 

If you're seeing this message, 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 

如果我錯了嗎?

+0

可能重複的[致命錯誤:無法找到本地咕嚕聲](http://stackoverflow.com/questions/13925916/fatal-error-unable-to-find-local-咕嚕) – Pracede

回答

3

你必須在全球範圍內安裝咕嚕和本地

你用-g標誌將安裝CLI全球

現在你必須在你的package.json與本地安裝...

npm install -SD grunt 

那麼你的「咕嚕」命令將工作 - 假設你有一個有效的gruntfile

+0

謝謝你的回答,但我會結束這個問題,因爲它重複 – Pracede

1

這看起來像的Fatal error: Unable to find local grunt重複。

簡而言之,嘗試運行grunt:initnpm:init第一(取決於你擁有的版本見鏈接的問題更多細節

+0

是的,它是重複的。我會關閉 – Pracede