在Mac上的终端上安装express

时间:2015-12-26 02:57:45

标签: node.js macos express operating-system

我收到此代码。我在Mac上。我安装了npm。我是管理员。我究竟做错了什么?我一直在谷歌搜索几个小时。

Matts-MacBook-Pro-3:Start Matt$ npm install express-generator -g
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/express-generator
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── express-generator@4.13.1 

npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express-generator" "-g"
npm ERR! node v5.3.0
npm ERR! npm  v3.3.12
npm ERR! path /usr/local/lib/node_modules/express-generator
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/express-generator']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/express-generator' }
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!     /Users/Matt/Start/Start/npm-debug.log
Matts-MacBook-Pro-3:Start Matt$ 

1 个答案:

答案 0 :(得分:0)

尝试清除npm缓存并再次尝试npm安装。您可以使用以下命令清除npm缓存。

npm cache clean <path to express-generator>

有时即使你在ssh上也会出现这个错误,npm注册表可能被配置为对npm包使用不同的注册表,并且该注册表可能没有快速生成器