Reputation: 570
I am getting a very odd error trying to install the express-generator with and without sudo
.
I need to run: npm install express-generator -g
and then express --ejs name_here
but when executing the first command, I get the following error:
npm ERR! Darwin 15.2.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "express-generator" "-g"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path /Users/[name]/.npm/lib/node_modules/express-generator/LICENSE
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, unlink '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, unlink '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, unlink '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, unlink '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/Users/[name]/.npm/lib/node_modules/express-generator/LICENSE' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/[name]/Documents/Projects/MEAN Stack Tutorial/npm-debug.log
After trying sudo npm install express-generator -g
I get this:
/Users/[name]/.npm/bin/express -> /Users/[name]/.npm/lib/node_modules/express-generator/bin/express
[email protected] /Users/[name]/.npm/lib/node_modules/express-generator
├── [email protected]
├── [email protected] ([email protected])
└── [email protected] ([email protected])
Then running express --ejs name_here
returns -bash: express: command not found
Is there a way I can solve this issue? The other questions on SO seem to have fixed the issue by trying sudo but not for me.
Upvotes: 0
Views: 454
Reputation: 519
Try to use an express
command with a full path: /Users/[name]/.npm/bin/express
or sudo /Users/[name]/.npm/bin/express
.
Looks like PATH
variable wasn't set after installation. (https://en.wikipedia.org/wiki/PATH_(variable))
Upvotes: 1