2014-10-01 76 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