_From @sittingbool on June 13, 2017 8:51_
Please, ensure your title is less than 63 characters long and starts with a capital
letter.
iOS/Android/Both
MacOSX 10.12.5
tns --version to fetch it)node_modules/tns-core-modules/package.json file in your project)"tns-android" and "tns-ios" properties in thepackage.json file of your project)package.json file of yoursudo npm install -g nativescript
Output is:
EACCES: permission denied, mkdir '/usr/local/lib/node_modules/nativescript/docs/html'
I guess its because the directory docs in /usr/local/lib/node_modules/nativescript/ is under my personal user but the installer ties as root (which is confusing but Apple changed some permission features in OSX 10.12).
The install process seams to run until the end though. But its confusing for some people.
_Copied from original issue: NativeScript/NativeScript#4367_
_From @sittingbool on June 13, 2017 8:52_
Btw: if i create the directory myself I will still get the error and its gone again afterwards.
Hey, @sittingbool
Is there a specific reason you need to install nativescript with sudo?
On Mac you have to install all global modules as super-user because the directory it gets installed to is a Unix system directory. Same on Linux based operating systems btw. Sure you could change the ownership of the /usr/local/lib/node_modules directory but Apple advises against that, also it would break a safety feature (system changing installations need users password as permission) and by experience I can say that it even breaks some npm modules if they aren't in a root-owned directory on a Unix based machine when globally installed.
When running sudo npm install -g nativescript npm executes postinstall scripts with a specific user -> _nobody_, who has no rights to your user's folders, so it is expected to behave like that. However, postinstall failure is not a problem and you do have nativescript installed after all. If you want to be sure that the postinstall succeeds you can execute sudo npm install -g nativescript --unsafe-perm. Hope this helps.
perfect, thank you
@pkoleva can you please submit your answer in the official NativeScript documentation. Because the standard security level of the Mac OS Mojave require your method.
I also runned mkdir /usr/local/lib/node_modules/nativescript/docs/html, and it just went through, so I guess the problem is with the docs folder.
Node v10.4.0
Most helpful comment
When running
sudo npm install -g nativescriptnpm executes postinstall scripts with a specific user -> _nobody_, who has no rights to your user's folders, so it is expected to behave like that. However, postinstall failure is not a problem and you do have nativescript installed after all. If you want to be sure that the postinstall succeeds you can executesudo npm install -g nativescript --unsafe-perm. Hope this helps.