Encountering a strange error while attempting to install the express-generator with and without using sudo
.
The necessary commands are: npm install express-generator -g
followed by express --ejs name_here
. However, upon executing the first command, the following error is displayed:
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
When attempting
sudo npm install express-generator -g
, the output is as follows:
/Users/[name]/.npm/bin/express -> /Users/[name]/.npm/lib/node_modules/express-generator/bin/express
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5809d9597809696c882808b809784918a97a5d1cbd4d6cbd4">[email protected]</a> /Users/[name]/.npm/lib/node_modules/express-generator
├── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a1d2ced3d5c4c58ccec3cbc4c2d5e1908f918f91">[email protected]</a>
├── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3a595557575b545e5f487a08140d140b">[email protected]</a> (<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="76110417151310031a5b041317121a1a5914171b17161bf40815184155181817141">[email protected]</a>)
└── <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9ff2f4fbf6edefdfafb1aab1ae">[email protected]</a> (<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="adc0c4c3c4c0c4ded9ed9d839d8395">[email protected]</a>)
However, trying to run express --ejs name_here
results in
-bash: express: command not found
How can I resolve this issue? Other similar queries on SO suggest using sudo, but that hasn't worked for me so far.