“EACCES: permission denied” when installing NativeScript

Installing NativeScript can be a challenge. The NativeScript instructions do not make is totally clear that you must be root when you install it. But even so, you might encounter the following issue:

EACCES: permission denied, mkdir '/usr/lib/node_modules/nativescript/docs/html'

Further down in the logging output you may also see this:

Error while reporting exception: Error: EACCES: permission denied, mkdir '/home/user/.local/share/.nativescript-cli'

The solution for this issue is to use NPM in the following manner:

sudo npm install -g --unsafe-perm nativescript

According to the reference below, when NPM is run some things have root privileges and some not but the above command should work around the issue for now.

Reference:
https://github.com/NativeScript/nativescript-cli/issues/1364

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *