遵循Angular2 5分钟快速入门时npm安装错误

时间:2016-01-07 13:34:46

标签: node.js npm angular

在遵循Angular2 5分钟快速启动时出现错误。我怎么能超越它?

vagrant@vagrant-ubuntu-trusty-64:/vagrant/angular2-tutorial$ sudo npm install   angular2-quickstart@1.0.0 /vagrant/angular2-tutorial
└── foxy@11.1.4  extraneous

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.6
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
npm ERR! Linux 3.13.0-74-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v5.4.0
npm ERR! npm  v3.5.2
npm ERR! path /vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall rename

npm ERR! Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'
npm ERR!     at destStatted (/usr/local/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at FSReqWrap.oncomplete (fs.js:82:15)
npm ERR!
npm ERR! Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, rename '/vagrant/angular2-tutorial/node_modules/.staging/lodash-496d43d7' -> '/vagrant/angular2-tutorial/node_modules/browser-sync/node_modules/lodash'] parent: 'browser-sync' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.13.0-74-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install"
npm ERR! node v5.4.0
npm ERR! npm  v3.5.2
npm ERR! path npm-debug.log.727051537
npm ERR! code ETXTBSY
npm ERR! errno -26
npm ERR! syscall rename

npm ERR! ETXTBSY: text file is busy, rename 'npm-debug.log.727051537' -> 'npm-debug.log'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/angular2-tutorial/npm-debug.log

这是错误日志: https://www.dropbox.com/s/xr6ha3z4re0npvi/npm-debug.log.727051537?dl=0

1 个答案:

答案 0 :(得分:1)

看起来这是许可问题。 npm配置为将下载的模块放入未授权的目录。

您可以配置npm以使用prefix配置将模块安装到自定义目录。

参考以下文章:

Use one of these techniques to install node and npm without having to sudo

Installing Node and npm