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

JavaScript Express Basics Getting Started with Express Adding Multiple Routes to the App

Jason Nutt
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jason Nutt
Front End Web Development Techdegree Graduate 24,760 Points

I am getting this error when I try to install nodemon either globally or without the global tag ...npm WARN checkPermiss

Here is the error that the terminal gives when I type in npm install -g nodemon. I am assuming I can continue without and I will just have to restart the server whenever it needs it. npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR! /Users/jasonnutt/.npm/_logs/2021-02-23T21_44_11_465Z-debug.log Waiting for the debugger to disconnect...

Anyways thanks in advance if you are able to help me understand this

Jacob Dahlberg
seal-mask
.a{fill-rule:evenodd;}techdegree
Jacob Dahlberg
Python Development Techdegree Student 13,154 Points

I run into similar errors when I'm not signed into my admin account. When running and installing applications through terminal/console I'm in the habit of switching over to the admin account on my computer. This may not be exactly your case, I'd google as I'm sure you've done to find a workaround or the cause. In some cases using a company/library/school computer may have challenges accessing permissions set up by the network administrator.

You are correct nodemon is not a necessity for this course, just a shortcut for repetitive restarting of the local server.

Good luck!

2 Answers

You should be able to get around this by using

npx nodemon app.js

to start your server using nodemon without permanently installing it, this should solve the permissions problem. Npx is also nice for using packages you want to try out or use temporarily but don't necessarily want installed on your machine for whatever reason. I'd think twice about running anything as administrator unless you absolutely need to, as this is a security concern and it's pretty easy to compromise your computer this way. Of course, any node modules recommended by TreeHouse are probably very safe, but its a good thing to keep in mind as you move forward with development and want to play around with different modules you discover yourself.