Npm ERR! Please try running this command again as root/Administrator


#1

Hi, I tried to run ‘npm install -g create-react-app’. But it always returns Error

npm WARN 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/mohamed/.npm/_logs/2018-04-23T10_41_59_081Z-debug.log


#2

-g means you want to install this package globally, this does indeed require additional privileges.


#3

(Which isn’t really something appropriate to do - install such things under your user instead)
Lacking permission to do something doesn’t necessarily mean more permissions should be obtained, could also mean doing something else (programs can’t really tell you what you want, up to the user to consider the situation)


#4

True, which is why i only informed the user what -g means, they can then consider what they want to do.


#5

I don’t understand what you’r talking about…


#6

Be more specific. There’s no easy/accurate way to reply to that.

What you ought to be doing right now (or before asking, really) is carefully reading the error message and obtaining an idea of what is going on. Error messages are there for reading.

And after that you might ask questions to fill any gaps you might have (again, be specific about what you want to know)

Followed by considering your options. Since it’s a permission error that leaves you with two simple options: do something else or get permission

After making a decision about what to do, you can start thinking about how to carry out that action.


#7

I want to create react app


#8

that might be so, but why would you want to do a global installation?


#9

I don’t know the difference, I’m just following the course. They demand to do global installation


#10

One of the most important aspects of programming is understanding what you are actually doing. If you really want to go for the global installation, you should opt for giving additional privileges on the npm install command


#11

YES, I KNOW.
AND MEAN I don’t know if I’ll need the global installation in the next project.

IF YOU DON’T KNOW THEM YOU CAN SKIP MY PROBLEM


#12

I think we’re simply of different attitudes on who should be solving the problem.
From our perspective it’s up to you to ask questions so that you can solve it yourself.
If you instead use the slack channel set up for that program, staff is likely more willing to skip ahead to a solution.


#13

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.