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.

sudo npm install fails

See original GitHub issue

Most likely a bug with go-npm (https://github.com/sanathkr/go-npm) because it handles the installation. But filing a Issue here nevertheless for other folks to be aware of. A fix is on the way.

sudo npm install -g aws-sam-local
Password:
-
> aws-sam-local@0.1.1 postinstall /Users/sanathkr/.nvm/versions/node/v4.3.0/lib/node_modules/aws-sam-local
> go-npm install

Downloading from URL: https://github.com/awslabs/aws-sam-local/releases/download/v0.1.1/sam_0.1.1_darwin_amd64.tar.gz
fs.js:681
  return binding.rename(pathModule._makeLong(oldPath),
                 ^

Error: EACCES: permission denied, rename 'bin/sam' -> '/Users/sanathkr/.nvm/versions/node/v4.3.0/bin/sam'
    at Error (native)
    at Object.fs.renameSync (fs.js:681:18)
    at /Users/sanathkr/.nvm/versions/node/v4.3.0/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:62:12
    at /Users/sanathkr/.nvm/versions/node/v4.3.0/lib/node_modules/aws-sam-local/node_modules/go-npm/bin/index.js:51:9
    at ChildProcess.exithandler (child_process.js:204:7)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
npm ERR! Darwin 16.6.0
npm ERR! argv "/Users/sanathkr/.nvm/versions/node/v4.3.0/bin/node" "/Users/sanathkr/.nvm/versions/node/v4.3.0/bin/npm" "install" "-g" "aws-sam-local"
npm ERR! node v4.3.0
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! aws-sam-local@0.1.1 postinstall: `go-npm install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the aws-sam-local@0.1.1 postinstall script 'go-npm install'.
npm ERR! This is most likely a problem with the aws-sam-local package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     go-npm install
npm ERR! You can get their info via:
npm ERR!     npm owner ls aws-sam-local
npm ERR! There is likely additional logging output above.

> aws-sam-local@0.1.1 preuninstall /Users/sanathkr/.nvm/versions/node/v4.3.0/lib/node_modules/aws-sam-local
> go-npm uninstall


npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sanathkr/workspace/GoWorkspace/src/github.com/awslabs/aws-sam-local/npm-debug.log

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:37 (9 by maintainers)

github_iconTop GitHub Comments

71reactions
pankajsamsungcommented, Nov 17, 2017

Following fixed for me

npm config set unsafe-perm=true

28reactions
mhartcommented, Oct 10, 2017

(Option 1 from that document should fix most ppl’s permissions issues)

sudo chown -R $(whoami) /usr/local/{lib/node_modules,bin,share}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix npm throwing error without sudo - Stack Overflow
Solution 2: Install packages globally for a given user · 2. If node is installed by sources, although multiuser would be a problem,...
Read more >
Don't use `sudo` with `npm`. Running sudo npm install - Medium
Using sudo npm install (and potentially sudo npm <anything> ) is a bad idea ™. This is an issue for at least a...
Read more >
Resolving EACCES permissions errors when installing ...
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in "Downloading and...
Read more >
NPM install error - Material Design for Bootstrap
Trying to install MDB pro 4.19.2 just downloaded and ran npm install but getting this error of sha512 not matching. Can someone tell...
Read more >
Don't use "sudo" with NPM "install" - DEV Community ‍ ‍
Using "sudo" when installing NPM packages may put your computer at risk, by giving untrusted code administrative privileges. Please do not use " ......
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