C
C
codemix2016-03-08 09:46:20
ubuntu
codemix, 2016-03-08 09:46:20

How to solve the problem with rights?

When installing npm packages, for example: sudo npm i -D node-sassthe permissions of the package.json file change from user to root, and do not allow editing package.json in a text editor, you have to change permissions sudo chown atom:atom package.jsonwhen installing any npm packages, how to solve this problem in which direction to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2016-03-08
@k12th

standard error. Copying from another question:
You're doing sudo but trying to install a package locally.
What you need is done in the project directory and without sudo. sudo is only needed when installing a package globally: sudo npm install express-generator -g. When you install a lib for development, sudo is unnecessary and even harmful: npm install gulp-some-plugin --save-dev.
Once again: if there is -g, then you need to sudo, because changes are made to the system, globally. If there is --save or --save-dev (-D in your case), then this is written in the package.json of this project, locally, admin rights are not needed for this, so sudo is not needed.

S
saveTibet, 2016-07-27
@alekseyruzov

And what is harmful to put globally?
It is convenient to deliver once for all future projects. Or am I wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question