簡體   English   中英

嘗試安裝grunt時出錯

[英]Error trying to install grunt

我使用以下代碼安裝了grunt:

npm install -g grunt-cli

當我運行grunt --version它返回我的版本:

grunt-cli v0.1.13

但是當我轉到我的項目文件夾並運行npm install ,它會返回錯誤消息:

npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/Applications/XAMPP/xamppfiles/htdocs/grunt/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Applications/XAMPP/xamppfiles/htdocs/grunt
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /Applications/XAMPP/xamppfiles/htdocs/grunt/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Applications/XAMPP/xamppfiles/htdocs/grunt/npm-debug.log
npm ERR! not ok code 0

我做錯了什么? 我只是谷歌一段時間,我找不到我的問題的答案,有人可以幫助我嗎?

npm installpackage.json文件中讀取並安裝依賴項,與grunt無關。

node告訴您沒有package.json文件。

通過運行npm init創建一個package.json ,然后單步執行該過程。

要保存對package.json文件的依賴關系,您將運行

npm install grunt --save-dev

以上命令中的grunt是依賴項的示例。

此外,您還沒有實際安裝grunt - 您已經安裝了grunt命令行界面,其作用是充當本地grunt安裝的接口。 你還沒有在本地安裝grunt(從你所顯示的內容)。

npm install grunt --save-dev將在本地為您安裝(並將其保存為package.json文件中的依賴項)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM