[英]Issue with “npm install” after setting up AngularJS project with Yeoman
我的問題出現在使用命令創建角項目之后(甚至在此期間):
yo angular
在從package.json安裝所有devDependencies的過程中(“ npm install ”,你的角度運行)我注意到node_modules文件夾中缺少一些模塊。
所以,我之后再次使用“npm install name_of_the_module --save-dev”下載(因此他們將下載並包含在devDependencies選項中的package.json中)。
但是例如,如果我刪除node_modules文件夾並執行命令npm install它將啟動安裝但會遺漏一些模塊,有時缺少的模塊與上次運行的npm install不同。
我不知道如何面對這個,因為我需要為團隊設置項目,他們要做的第一件事就是執行npm install&bower install (最后一個工作正常)。
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 install后得到的錯誤或日志是:
npm WARN optional dep failed, continuing imagemin-optipng@1.0.0
npm WARN optional dep failed, continuing http-signature@0.10.0
npm WARN optional dep failed, continuing imagemin-jpegtran@1.0.0
npm WARN optional dep failed, continuing imagemin-pngquant@1.0.2
npm WARN optional dep failed, continuing imagemin-gifsicle@1.0.0
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的創建者建議下載最后一個版本,該版本只有......
npm install -g npm @ next
要么
npm install -g npm@2.1.2(在這種情況下僅適用於當前版本2.1.2,這是最新版本)
要么
當我找到github討論時,我會用它更新帖子。
這是錯誤,可以通過更新你的npm版本來修復( https://github.com/npm/npm/issues/6318 )。 嘗試:npm -g install npm @ next
文件存在:C:\\ Users \\ _自己\\ AppData \\ Roaming \\ npm-cache \\ 78af9c6a-m-cache-lodash-2-4-1-package-tgz.lock將其移開,然后重試。
看起來npm是從你的緩存中解析的,嘗試#npm cache clear (更多信息 )以確保包沒有從npm的緩存中加載任何東西。
很可能是由於npm中的這個錯誤 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.