NodeJS - NPM无法安装nodemon软件包

时间:2016-04-21 07:59:22

标签: node.js npm nodemon

我一直在尝试使用nodemon安装npm install -g nodemon,但我一直收到以下错误。请帮忙

C:\Users\AllJs\Desktop\FF>npm install -g nodemon
npm ERR! tar.unpack untar error C:\Users\chris\AppData\Roaming\npm-cache\nodemon\1.9.1\package.tgz
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\AllJSAdmin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "nodemon"
npm ERR! node v4.2.3
npm ERR! npm  v2.13.1
npm ERR! path C:\Program Files\nodejs\node_modules\nodemon
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir

npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\nodemon'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\nodemon']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Program Files\\nodejs\\node_modules\\nodemon',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: 'C:\\Program Files\\nodejs\\node_modules\\nodemon',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack:
npm ERR!    [ 'C:\\Users\\AllJSAdmin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\fstream\\lib\\dir-writer.js:35:25',
npm ERR!      'C:\\Users\\AllJSAdmin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\mkdirp\\index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\AllJS\Desktop\FF\npm-debug.log

1 个答案:

答案 0 :(得分:0)

您不能写信给C:\Program Files\nodejs\node_modules\。检查你的npm配置,它不应该试图在那里存储包。

运行npm config get prefix以确定当前的npm文件夹前缀。在我的Windows机器上,这将返回以下形式的内容:

C:\Users\<My Username>\AppData\Roaming\npm

这是用户可写的位置。