Amplify-cli: npm install globally failing (Error: EACCES: permission denied, mkdir)

Created on 3 Oct 2019  路  5Comments  路  Source: aws-amplify/amplify-cli

Describe the bug
I am having trouble installing this package globally. I run the following:
sudo npm i -g @aws-amplify/cli

and get the following:

npm WARN deprecated @types/[email protected]: This is a stub types definition. ora provides its own type definitions, so you do not need this installed.
npm WARN deprecated [email protected]: Use uuid module instead
/Users/emmafass/.nvm/versions/node/v8.12.0/bin/amplify -> /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/bin/amplify

> [email protected] install /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext
> node-gyp configure build

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/emmafass/.nvm/versions/node/v8.12.0/bin/node" "/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/fs-ext
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> [email protected] install /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/kerberos/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/emmafass/.nvm/versions/node/v8.12.0/bin/node" "/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/kerberos
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> [email protected] install /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/snappy
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/snappy/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/Users/emmafass/.nvm/versions/node/v8.12.0/bin/node" "/Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/snappy
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

> [email protected] install /Users/emmafass/.nvm/versions/node/v8.12.0/lib/node_modules/@aws-amplify/cli/node_modules/amplify-dynamodb-simulator
> download --extract -o emulator https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip

Error: EPERM: operation not permitted, utime 'emulator/DynamoDBLocal_lib/'
npm WARN @conduitvc/[email protected] requires a peer of leveldown@~1.4.3 but none is installed. You must install peer dependencies yourself.
npm WARN @conduitvc/[email protected] requires a peer of ioredis@^1.15.1 but none is installed. You must install peer dependencies yourself.
npm WARN @conduitvc/[email protected] requires a peer of mongodb@~2.1.4 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@aws-amplify/cli/node_modules/fs-ext):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp configure build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@aws-amplify/cli/node_modules/snappy):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `download --extract -o emulator https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I then tried without the global flag and it works.

Just wondering if I am doing something wrong?

To Reproduce
Using MacOS High Sierra (v10.13.6)

Most helpful comment

Please use sudo npm install -g @aws-amplify/cli --unsafe-perm=true to get around this.

All 5 comments

Please use sudo npm install -g @aws-amplify/cli --unsafe-perm=true to get around this.

Thanks so much! That worked

This worked, thanks

And this help me, thanks :)

It still didn't work for me. I had to do:

su (and enter the admin's password when prompted)

and it created another terminal session where then the sudo command worked!

Was this page helpful?
0 / 5 - 0 ratings