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
well, actually, tns still works
I get the same error.
Edit:
This solved it: npm install -g --unsafe-perm nativescript
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.
I ran tns doctor after npm finished and looks like added, what npm i could not.
Why do so many node packages insist on adding a hidden directory to the current users home folder?
Most helpful comment
I get the same error.
Edit:
This solved it: npm install -g --unsafe-perm nativescript