[英]Multiple npm install fails (EPERM error)
Im trying to install multiple packages in different child processes. 我试图在不同的子进程中安装多个包。 And all the packages have some common dependency(browserify in my case). 并且所有包都有一些共同的依赖(在我的情况下是browserify)。
example
|
|_pkg1
| |_browserify
|
|_pkg2
| |_browserify
|
|_pkg3
| |_browserify
|
|_run.js
run.js: run.js:
var packages = ['pkg1', 'pkg2', 'pkg3'];
packages.forEach(function(pkg){
exec('npm install ./' + pkg);
});
And node run.js
fails with log node run.js
失败并带有日志
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "c:\\Program Files\\nodejs\\\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i
nstall" "./pkg3"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! path C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, rename 'C:\Users\Artem\AppData\Roaming\npm-cache\acorn\0.9.0\package\package.json']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\Users\\Artem\\AppData\\Roaming\\npm-cache\\acorn\\0.9.0\\package\\package.json',
npm ERR! parent: 'syntax-error' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
Example: https://github.com/SakerONE/multiple-npm-install 示例: https : //github.com/SakerONE/multiple-npm-install
Works fine with npm 2.9.1 适用于npm 2.9.1
Just try to upgrade your npm 试着升级你的npm
npm install npm@latest -g
This seems to be a tricky bug in npm, most probably, a race condition of parallel tasks writing the same package.json. 这似乎是npm中一个棘手的错误,很可能是并行任务编写相同package.json的竞争条件。
You can use --force
flag to avoid cache (but it might be slow to download all dependencies on each build). 您可以使用--force
标志来避免缓存(但是在每个构建中下载所有依赖项可能会很慢)。 Or wait for npm team to implement a permanent fix. 或者等待npm团队实施永久性修复。
Related links to watch on Github: 在Github上观看的相关链接:
https://github.com/Microsoft/vso-agent-tasks/issues/323 https://github.com/Microsoft/vso-agent-tasks/issues/323
https://github.com/npm/npm/issues/2500 https://github.com/npm/npm/issues/2500
https://github.com/npm/npm/issues/9696 https://github.com/npm/npm/issues/9696
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.