2014-10-01 81 views
4

出現我的問題後(​​甚至期間)與命令的角度項目的創建:安裝所有devDependencies的過程中問題與「故宮安裝」設置AngularJS項目,約曼

yo angular 

從package.json(「npm install」這是yo角度運行)我注意到node_modules文件夾中缺少一些模塊。

所以,我一遍後下載的「故宮安裝name_of_the_module --save-dev的」(所以他們會下載幷包含在devDependencies選項的package.json)。

但例如如果我刪除node_modules文件夾,我執行命令NPM安裝將開始安裝,但會錯過一些模塊,有時缺少的模塊是由安裝NPM的最後一次運行不同。

我不知道該怎麼面對這一點,因爲我需要設置爲團隊,他們將要做的是執行的第一件事項目NPM安裝&涼亭安裝(最後一個工作正常)。

的package.json的內容是:

{ 
    "name": "angular_test", 
    "version": "0.0.0", 
    "dependencies": {}, 
    "devDependencies": { 
    "grunt": "^0.4.5", 
    "grunt-autoprefixer": "^0.7.6", 
    "grunt-concurrent": "^0.5.0", 
    "grunt-contrib-clean": "^0.5.0", 
    "grunt-contrib-concat": "^0.4.0", 
    "grunt-contrib-connect": "^0.7.1", 
    "grunt-contrib-copy": "^0.5.0", 
    "grunt-contrib-cssmin": "^0.9.0", 
    "grunt-contrib-htmlmin": "^0.3.0", 
    "grunt-contrib-imagemin": "^0.8.1", 
    "grunt-contrib-jshint": "^0.10.0", 
    "grunt-contrib-uglify": "^0.4.1", 
    "grunt-contrib-watch": "^0.6.1", 
    "grunt-filerev": "^0.2.1", 
    "grunt-google-cdn": "^0.4.0", 
    "grunt-karma": "^0.9.0", 
    "grunt-newer": "^0.7.0", 
    "grunt-ng-annotate": "^0.3.2", 
    "grunt-svgmin": "^0.4.0", 
    "grunt-usemin": "^2.4.0", 
    "grunt-wiredep": "^1.7.0", 
    "imagemin-jpegtran": "^2.0.0", 
    "imagemin-pngquant": "^2.0.0", 
    "jshint-stylish": "^0.2.0", 
    "karma": "^0.12.24", 
    "karma-jasmine": "^0.1.5", 
    "karma-phantomjs-launcher": "^0.1.4", 
    "load-grunt-tasks": "^0.6.0", 
    "time-grunt": "^0.3.2" 
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    }, 
    "scripts": { 
    "test": "grunt test" 
    } 
} 

和錯誤或日誌執行NPM安裝後,我得到的是:

npm WARN optional dep failed, continuing [email protected] 
npm WARN optional dep failed, continuing [email protected] 
npm WARN optional dep failed, continuing [email protected] 
npm WARN optional dep failed, continuing [email protected] 
npm WARN optional dep failed, continuing [email protected] 
npm ERR! EEXIST, open 'C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock' 
File exists: C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock 
Move it away, and try again. 

npm ERR! System Windows_NT 6.2.9200 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! cwd C:\Users\myself\Documents\PHPStorm_Workspace\angular_test 
npm ERR! node -v v0.10.32 
npm ERR! npm -v 1.4.28 
npm ERR! path C:\Users\myself\AppData\Roaming\npm-cache\78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock 
npm ERR! code EEXIST 
npm ERR! errno 47 
npm ERR! not ok code 0 

UPDATE

所有這些問題的出現因爲「npm」所以研究一下之後,npm的創建者建議下載最後的版本,這是唯一可用的eith呃......

NPM安裝-g NPM @未來

NPM安裝-g [email protected](在這種情況下,僅適用於當前版本2.1 。2,這是最新的版本)

+0

下面是在Windows中修復此問題的詳細說明:http://stackoverflow.com/a/26547749/168205 – dbasch 2015-01-31 16:02:18

回答

1

文件存在: C:\用戶\我\應用程序數據\漫遊\ NPM-緩存\ 78af9c6a-M-緩存lodash-2-4-1-包tgz.lock 將其移開,並再試一次。

好像NPM從緩存resolvng,嘗試#NPM緩存明確(更多info),以確保包裝沒有加載從故宮的緩存任何東西。

+1

我嘗試了幾次,但即使在清理緩存後也會出現該消息並重新運行「故宮安裝」再次 – 2014-10-01 18:23:15

+0

嗯只是爲了好奇,嘗試改變你的package.json依賴於2.4.0,做一套NPM安裝 – 2014-10-01 19:48:05

+0

這依賴我應該改變到2.4.0? – 2014-10-01 20:59:01

1

最有可能是因爲npm中的this bug