2014-05-20 46 views
37

我剛收到一份咕嚕包的副本,但我是新手,並且無法找到幾件事情的答案。最大的問題是不知道下面的錯誤來自哪裏 - 有人能告訴我這是從哪裏來的嗎?這兩個文件都在同一個目錄中。grunt - 找不到「本地Npm模塊」xxx「,是否安裝?」這是什麼造成的?

$ grunt 
>> Local Npm module "grunt-contrib-clean" not found. Is it installed? 
>> Local Npm module "grunt-contrib-concat" not found. Is it installed? 
>> Local Npm module "grunt-contrib-copy" not found. Is it installed? 
>> Local Npm module "grunt-contrib-cssmin" not found. Is it installed? 
>> Local Npm module "grunt-contrib-handlebars" not found. Is it installed? 
>> Local Npm module "grunt-contrib-jshint" not found. Is it installed? 
>> Local Npm module "grunt-contrib-qunit" not found. Is it installed? 
>> Local Npm module "grunt-contrib-uglify" not found. Is it installed? 
>> Local Npm module "grunt-preprocess" not found. Is it installed? 
>> Local Npm module "grunt-wrap" not found. Is it installed? 
>> Local Npm module "grunt-debug-task" not found. Is it installed? 
Warning: Task "clean" not found. Use --force to continue. 

Aborted due to warning. 

$ 

這裏是我的package.json:

{ 
    "name": "baked-widget", 
    "srcDirectory": "./src", 
    "srcJavascript": "./src/js", 
    "srcCss": "./src/css", 
    "srcData": "./src/data", 
    "testDirectory": "./test", 
    "tgtDirectory": "./build", 
    "installDirectory": "../com/public/widgets", 
    "version": "4.2.0", 
    "devDependencies": { 
    "grunt": "~0.4", 
    "grunt-contrib-clean": "~0.4.0", 
    "grunt-contrib-concat": "~0.3.0", 
    "grunt-contrib-copy": "~0.5.0", 
    "grunt-contrib-cssmin": "~0.9.0", 
    "grunt-contrib-handlebars": "~0.6", 
    "grunt-contrib-jshint": "~0.8", 
    "grunt-contrib-uglify": "~0.3", 
    "grunt-contrib-qunit": "~0.4", 
    "grunt-contrib-watch": "~0.5", 
    "grunt-preprocess": "~4.0", 
    "grunt-wrap": "~0.3", 
    "grunt-debug-task": "~0.1.4" 
    } 
} 

回答

59

您可能還沒有在本地安裝必要的程序包。嘗試npm installsudo npm install)以確保你做到了。

+0

是的,你需要確保本地安裝你使用的庫:p – Ethan

+0

這對我有效 –

9

如果接受的答案不工作,你有一個正確的package.json文件,您可以:

  1. 刪除node_modules文件夾(或其他地方進行備份)

  2. ,然後運行npm install

爲了重新開始。

相關問題