Amplify-cli: gyp ERR! stack Error: EACCES: permission denied, mkdir...

Created on 12 Aug 2019  路  1Comment  路  Source: aws-amplify/amplify-cli

Describe the bug
amplify-cli fails to install using npm install -g @aws-amplify/cli

gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/10.15.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/kerberos/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/kerberos/.node-gyp'
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/kerberos
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/root/.node-gyp/10.15.1"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext/.node-gyp'
gyp ERR! System Linux 4.15.0-54-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/local/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0

To Reproduce
docker run -it node:10-alpine sh -c "apk add python && npm install -g @aws-amplify/cli"

Expected behavior
install cleanly

logs
amplify_cli_install_logs.txt

environment details
node 10 & 12. In used node's docker image in the steps to reproduce. I came across this issue running ubuntu 16 and was able to replicate exactly in docker.

Additional context
Older versions still work. I was able to successfully install 1.7.1:

docker run -it node:12-alpine sh -c "apk add python && npm install -g @aws-amplify/[email protected]"

Most helpful comment

@AustinDeric Using npm install -g @aws-amplify/cli --unsafe-perm=true with the unsafe-perm param. Duplicate of #1996

>All comments

@AustinDeric Using npm install -g @aws-amplify/cli --unsafe-perm=true with the unsafe-perm param. Duplicate of #1996

Was this page helpful?
0 / 5 - 0 ratings