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 trial

APIs

Desmond Dallas
Desmond Dallas
6,985 Points

NPM - Installing http -server

Hi all im trying to install the http-server on the NPM course. Spent a whole 5 hours now and cant get any further. Can anyone tell me what is going on. Please see the following error message. I tried following the steps in the teachers notes but no luck.

checkPermissions Missing write access to /usr/lib/node_modules
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules \'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/treehouse/.npm/_logs/2018-07-17T02_40_41_023Z-debug.log

2 Answers

Ari Misha
Ari Misha
19,323 Points

Hello there! If you're using Mac or Linux OS, you might need to run this npm as super/root admin. Just run it like below and provide necessary Shell authentication:

sudo npm i --save-dev http-server

OR

sudo npm i --save http-server

OR

yarn add http-server

(only if you're using yarn as package manager)

~ Ari

Desmond Dallas
Desmond Dallas
6,985 Points

Great thanks, I think that did the job