在与Yeoman一起设置AngularJS项目后,发布“npm install”

我的问题出现在angular度项目的创build之后(甚至在此期间):

yo angular 

在安装package.json(yo angular运行的“ npm install ”)中的所有devDependencies的过程中,我注意到node_modules文件夹中缺less一些模块。

所以,我再次下载了“npm install name_of_the_module –save-dev”(所以它们将下载并包含在devDependencies选项的package.json中)。

但例如,如果我删除node_modules文件夹,并执行命令npm安装它将开始安装,但会错过一些模块,有时缺less的模块不同于上次运行的npm安装。

我不知道如何面对这个,因为我需要为团队build立项目,他们将要做的第一件事就是执行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的创build者build议下载最后一个版本,这个版本只能用于…

npm install -g npm @ next

要么

npm install -g npm@2.1.2(在这种情况下,仅适用于当前版本2.1.2,这是最新版本)

要么

  • 下载源代码并复制安装了npm的内容(在安装了node.js的node_modules文件夹中): https ://www.versioneye.com/nodejs/npm/2.1.2

当我findgithub讨论时,我会用它更新这个post。

这是错误,可以通过更新你的npm版本来修复( https://github.com/npm/npm/issues/6318 )。 试试:npm -g安装npm @ next

文件存在:C:\ Users \ myself \ AppData \ Roaming \ npm-cache \ 78af9c6a -m-cache-lodash-2-4-1-package-tgz.lock将其移开,然后重试。

好像npm是从你的caching中parsing出来的,试试#npm cache clear (更多信息 )以确保一个包没有从npm的caching中加载任何东西。

很有可能是由于npm中的这个错误 。