gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/serverless/node_modules/snappy/.node-gyp'

Viewed 2966

I have an AWS CodeBuild Project which tries to install serverless framework but returns an error in the title however it says framework successfully installed. My understanding is that this fails to install the snappy module. Why is that and how can I resolve this?

The command I run in my buildspec.yaml is:

npm install -g serverless

And my user is:

/root

enter image description here

1 Answers

in the first error line:

gyp WARN EACCES current user ("nobody")...

seems node-gyp is trying to use another user instead of root,

we can find the issue discussed in the package repository:

the most recent solutions seems to be:

npm_config_user=root npm install -g ...

to force/set the environment user to be used by npm install process

Related