Useful or not, from you.
node-gyp gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
  • Node Version: node version 9.8.0 (8.11.1) and npm version 5.6.0
  • Platform Linux 4.9.76-xx.xx.amzn2.x86_64, MacBook Pro 10.13.6
  • Compiler: Terminal (SSH'd into EC2 Linux instance when compiling)
  • Module: node-gyp 3.8.0

Received Slack message regarding error with node_modules/fibers/bin/linux-x64-59/fibers' and recommendation to run a script. I ran the fibers/build script but, then received notification must install node-gyp. (Note* I see the rmdir 'build' in the error however, the command from the initial error told me to run the path including /build). To confirm the path we want for npm and node-gyp is: /opt/node/bin/ -- when ls -al I see npm and node-gyp are there.

Then the following error received after installing node-gyp:

[ec2-user@ip-xx.xx.xx /]$  /opt/node/bin/node /opt/something/server/node_modules/fibers/build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@9.8.0 | linux | x64
gyp ERR! clean error 
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Linux 4.9.76-xx.xx.amzn2.x86_64
gyp ERR! command "/opt/node/bin/node" "/opt/node/bin/node-gyp" "rebuild" "--release"
gyp ERR! cwd /
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Then received following after running command node-gyp rebuild:

node-gyp@3.8.0  /opt/node/lib/node_modules/node-gyp
node@9.8.0
[ec2-user@ip-xx.xx.xx /]$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@9.8.0 | linux | x64
gyp ERR! clean error 
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Linux 4.9.76-xx.xx.amzn2.x86_64
gyp ERR! command "/opt/node/bin/node" "/opt/node/bin/node-gyp" "rebuild"
gyp ERR! cwd /
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
That's a useful answer
Without any help

Hi,

From above comment following command worked for me: sudo npm install --unsafe-perm

Best regards, Zhitomir