question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

npm install -g fails with permission error

See original GitHub issue

Installation has failed for me twice, on machines with different architectures and node/npm versions. I get the same error on each platform:

`# npm i -g api-spec-converter /usr/local/bin/api-spec-converter -> /usr/local/lib/node_modules/api-spec-converter/bin/api-spec converter

jsonpath@0.2.12 postinstall /usr/local/lib/node_modules/api-spec-converter/node_modules/jsonpath node lib/aesprim.js > generated/aesprim-browser.js sh: generated/aesprim-browser.js: Permission denied npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! jsonpath@0.2.12 postinstall: node lib/aesprim.js > generated/aesprim-browser.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the jsonpath@0.2.12 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ Update available 5.3.0 โ†’ 5.4.2 โ”‚ โ”‚ Run npm i -g npm to update โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2017-09-21T06_47_16_083Z-debug.log`

2017-09-21T06_47_16_083Z-debugLog.txt

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:6
  • Comments:22

github_iconTop GitHub Comments

57reactions
capouchcommented, Sep 21, 2017

I can and do install global packages all the time. Just ahead of this install, I globally installed โ€œswagger-to-graphql,โ€ which is the point of this exercise; the files Iโ€™m converting need to be in Swagger v2 format, but they are currently in Swagger v1.

It failed to work with sudo, giving the same permissions error as it did with full root access.

However, while researching, I found a thread where the following syntax was explicated, and it installs just fine this way:

sudo npm install -g api-spec-converter --unsafe-perm=true --allow-root

This works in Linux Slackware64-current. Iโ€™m off to the races. Obviously, it may not work for everyone on all architectures, so the jsonpath folks should probably be made aware of the issue.

19reactions
wonk4rolcommented, Nov 22, 2018

it works for me ๐Ÿ˜ƒ

sudo npm install -g artillery --unsafe-perm=true --allow-root

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving EACCES permissions errors when installing ...
If you see an EACCES error when you try to install a package globally, you can either: Reinstall npm with a node version...
Read more >
npm, global install failing, getting Error: EACCES: permission ...
You are having a system permission issue. An easy way to avoid it is to use the sudo command: sudo npm install -g...
Read more >
Solving permission errors when installing NPM package
On the NPM site itself there are two possible solutions: install Node and NPM using a Node version manager or change the directory...
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 >
npm package fails to install "npm ERR! Error: EACCES ...
While trying to install a packge with npm (for example lodash) it fails with error message: npm ERR! Linux 3.4.0+ npm ERR! argvย ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found