node.js - npm install -g express 老是报错
迷茫
迷茫 2017-04-17 13:35:52
0
5
379

C:\Users\xxxxx>npm install -g express
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\soft\\nodejs\\node.exe" "D:\\soft\\nodejs\\node_modules\\npm\
\bin\\npm-cli.js" "install" "-g" "express"
npm ERR! node v5.7.1
npm ERR! npm v3.6.0
npm ERR! path D:\soft\nodejs\node_cache\express
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall mkdir

npm ERR! Error: EPERM: operation not permitted, mkdir 'D:\soft\nodejs\node_cache
\express'
npm ERR! at Error (native)
npm ERR! { [Error: EPERM: operation not permitted, mkdir 'D:\soft\nodejs\node_c
ache\express']
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'D:\\soft\\nodejs\\node_cache\\express' }
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\liudan\npm-debug.log

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(5)
洪涛

Obviously it is a permissions issue. You need to change the permissions of the npm default directory (use the chown command to change the owner of the npm directory to the current user):

sudo chown -R $(whoami) ~/.npm

Or this

sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

Reference:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
http://stackoverflow.com/questions/16151018/npm-throws-error-without- sudo

PHPzhong

This is a windows operating system. Just use the system administrator to run cmd and then run the command. No need to add sudo

小葫芦

Obviously your current user liudan does not have permission to create D:softnodejsnode_cacheexpress

Try creating this folder yourself, and then change the permissions in the properties

黄舟

If global installation requires permissions, use sudo npm i express -g

刘奇

Thank you for your guidance, the problem has been solved.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!