出現我的問題後(甚至期間)與命令的角度項目的創建:安裝所有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,這是最新的版本)
或
- 下載源和複製在安裝NPM其內容(您安裝的node.js的node_modules文件夾中):當我發現GitHub的討論中,我將它更新帖子 https://www.versioneye.com/nodejs/npm/2.1.2
。
下面是在Windows中修復此問題的詳細說明:http://stackoverflow.com/a/26547749/168205 – dbasch 2015-01-31 16:02:18