Postinstall fails on Antergos with EACCES: permission denied, mkdir '/usr/lib/node_modules/nativescript/docs/html'
See original GitHub issueFrom @heapifyman on June 19, 2018 12:32
Did you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
yes
Tell us about the problem
Postinstall script fails when running sudo npm install -g nativescript
. It produces the following error message:
> nativescript@4.1.1 postinstall /usr/lib/node_modules/nativescript
> node postinstall.js
EACCES: permission denied, mkdir '/usr/lib/node_modules/nativescript/docs/html'
Failed to display command help { Error: Unknown command 'post-install-cli'. Try '$ tns help' for a full list of supported commands.
at Errors.fail (/usr/lib/node_modules/nativescript/lib/common/errors.js:125:28)
at Errors.failWithoutHelp (/usr/lib/node_modules/nativescript/lib/common/errors.js:135:21)
at HelpService.<anonymous> (/usr/lib/node_modules/nativescript/lib/common/services/help-service.js:181:26)
at Generator.next (<anonymous>)
at fulfilled (/usr/lib/node_modules/nativescript/lib/common/services/help-service.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
name: 'Exception',
message:
'Unknown command \'post-install-cli\'. Try \'$ tns help\' for a full list of supported commands.',
stack:
'Error: Unknown command \'post-install-cli\'. Try \'$ tns help\' for a full list of supported commands.\n at Errors.fail (/usr/lib/node_modules/nativescript/lib/common/errors.js:125:28)\n at Errors.failWithoutHelp (/usr/lib/node_modules/nativescript/lib/common/errors.js:135:21)\n at HelpService.<anonymous> (/usr/lib/node_modules/nativescript/lib/common/services/help-service.js:181:26)\n at Generator.next (<anonymous>)\n at fulfilled (/usr/lib/node_modules/nativescript/lib/common/services/help-service.js:4:58)\n at process._tickCallback (internal/process/next_tick.js:68:7)',
errorCode: 127,
suppressCommandHelp: true,
proxyAuthenticationRequired: false,
printOnStdout: undefined }
Error while reporting exception: Error: EACCES: permission denied, mkdir '/root/.local/share/.nativescript-cli'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/nativescript/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
Running sudo node /usr/lib/node_modules/nativescript/postinstall.js
completes without errors.
/root/.local/share/.nativescript-cli
exists but maybe has wrong permissions?:
drwxr-xr-x 2 heapifyman root 4096 19. Jun 14:27 .nativescript-cli
Which platform(s) does your issue occur on?
Antergos Linux Linux 4.17.2-1-ARCH
Please provide the following version numbers that your issue occurs with:
- CLI: 4.1.1
Please tell us how to recreate the issue in as much detail as possible.
Run sudo npm install -g nativescript
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
No
Copied from original issue: NativeScript/NativeScript#5969
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Error: EACCES: permission denied, mkdir '/usr/local/lib ...
Solution: You need to change the ownership of folder node_modules , because you use sudo npm install -g node-sass , so its ownership...
Read more >NPM Install - Resolving EACCES Permissions Denied
How to resolve eacces permissions denied when installing npm packages globally. Here's how you solve this issue in a couple of minutes.
Read more >[kibana] Permission denied to mkdir under "plugins" while ...
Plugin installation was unsuccessful due to error "EACCES: permission denied, mkdir '/usr/share/kibana/plugins/.plugin.installing'"
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @Fatme ,
I’m sorry but I don’t think the issue is actually resolved. While
--unsafe-perm
seems to be a workaround I don’t see why that is necessary in the first place. I have installed several other packages viasudo npm i -g
and none of those had any permission problems. As far as I understand, the problem with nativescript is that it tries to write some thing to the root user’s home directory. My question here: why is that necessary at all, when other tools like angular-cli or ionic / cordova work fine without it?Secondly, and more importantly, the workaround is nowhere mentioned in any of the installation docs or getting started guides, as far as I can see. But based on other github issues linked to #1364 I see that I am not the first one to encounter this issue. As someone who is just trying out nativescript for the first time, it gives kind of a bad impression of the project when already the second step of the getting started guide (https://docs.nativescript.org/angular/start/quick-setup#step-2-install-the-nativescript-cli) fails with such an error. I would worry that several people hit this issue and without even having the chance to really try nativescript might have gotten the impression: “this project is no good, it doesn’t even install properly and apparently no one bothered to test the getting started guide before publishing it”.
Hi @heapifyman,
Can you please try to execute
sudo npm install -g nativescript --unsafe-perm
?