Skip to content

EACCES: permission denied, mkdir '/var/root/.local/share/.nativescript-cli' #1364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dmatora opened this issue Dec 25, 2015 · 5 comments
Closed

Comments

@dmatora
Copy link

dmatora commented Dec 25, 2015

Getting
Error: EACCES: permission denied, mkdir '/var/root/.local/share/.nativescript-cli' at FiberFuture.Future.wait (/usr/local/lib/node_modules/nativescript/node_modules/fibers/future.js:535:15) at /usr/local/lib/node_modules/nativescript/lib/nativescript-cli.js:20:45 - - - - - at Error (native)
when trying to do sudo npm i -g nativescript at OS X 10.11.2 (15C50)
npm - 3.3.12
node - v5.3.0
mkdir /var/root/.local/share/.nativescript-cli works fine and doesn't solve the issue

@dmatora
Copy link
Author

dmatora commented Dec 25, 2015

well, actually, tns still works

@nypraise
Copy link

nypraise commented Jan 1, 2016

I get the same error.

Edit:

This solved it: npm install -g --unsafe-perm nativescript

@rosen-vladimirov
Copy link
Contributor

Hi @dmatora ,
As @nypraise pointed, the solution is to use --unsafe-perm flag to npm install command. The reason is the default npm behavior when installing packages with sudo. When you use sudo, all pacakge scripts are executed with a special user - nobody. This is not the root user and so it cannot write to root's home dir. When --unsafe-perm flag is passed, the postinstall script, that is trying to write to home dir, is executed with the same user (root) and everything works correctly.

Unfortunately there's nothing we can do here, so I'm closing this issue.

@ceoaliongroo
Copy link

I ran tns doctor after npm finished and looks like added, what npm i could not.

@ghost
Copy link

ghost commented May 25, 2017

Why do so many node packages insist on adding a hidden directory to the current users home folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants