Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialevans tsai
3,735 PointsERR! on terminal when entering the npm command
When I type in
npm view
and it will generate
npm ERR! Darwin 16.1.0
npm ERR! argv "/Users/Evans/.nvm/versions/node/v7.1.0/bin/node" "/usr/local/bin/npm" "view"
npm ERR! node v7.1.0
npm ERR! npm v3.9.3
npm ERR! Invalid package.json
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Darwin 16.1.0
npm ERR! argv "/Users/Evans/.nvm/versions/node/v7.1.0/bin/node" "/usr/local/bin/npm" "view"
npm ERR! node v7.1.0
npm ERR! npm v3.9.3
npm ERR! path npm-debug.log.3022548996
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3022548996'
npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.3022548996'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: 'npm-debug.log.3022548996' }
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! /npm-debug.log
I google it, and it suggest me to reinstall the whole npm. Thus, I am already uninstall all my npm package by running:
sudo npm uninstall npm -g
and go to /usr/local/lib/node_modules/npm/ run
sudo make uninstall
However it's this method didn't solve the problem, I still encounter a bunch of ERR! When I using the npm command.
how can I solve the ERR!
1 Answer
Rodrigo Villalobos
2,546 PointsThe first line on the second block of the error reads npm ERR! Invalid package.json. Have you checked this file carefully? Maybe it would help if you posted it around here. Something that happens often to me is that I leave commas when declaring objects or arrays, but node/npm will throw an error when you leave a comma without something behind it. To better explain myself:
WRONG
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-sass": "^2.3.2",
}, ...
RIGHT
"devDependencies": {
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-sass": "^2.3.2"
}, ...
Notice the comma after gulp-sass version.