Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gyp ERR! stack Error: EACCES: permission denied, rmdir 'build' #1547

Closed
MJOAN opened this issue Sep 18, 2018 · 11 comments
Closed

gyp ERR! stack Error: EACCES: permission denied, rmdir 'build' #1547

MJOAN opened this issue Sep 18, 2018 · 11 comments
Labels
ERR! node-gyp -v < v10.x.x npm install -g npm

Comments

@MJOAN
Copy link

MJOAN commented Sep 18, 2018

  • 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 
@Mentors4EDU
Copy link

Try using the sudo chmod 777 command for the node_modules directory and if that doesn't work try
sudo npm install -g --unsafe-perm
or
sudo node-gyp rebuild -g --unsafe-perm

@bnoordhuis
Copy link
Member

You probably mixed permissions at one point. rmdir build manually (I'm betting it's owned by root) and run rebuild again. node-gyp will recreate it with the right permissions.

@esmejia277
Copy link

Try using the sudo chmod 777 command for the node_modules directory and if that doesn't work try
sudo npm install -g --unsafe-perm
or
sudo node-gyp rebuild -g --unsafe-perm

The second line worked for me, thanks a lot

@zhnedyalkow
Copy link

Hi,

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

Best regards,
Zhitomir

@nickkcuevas
Copy link

Try with this one! sudo npm install -g cordova-res --unsafe-perm flag

@andrewzey
Copy link

andrewzey commented Feb 12, 2021

This no longer works as of NPM 7 (packaged wit Node 15) as the --unsafe-perm flag has been removed: npm/cli#2196

@cclauss
Copy link
Contributor

cclauss commented Feb 12, 2021

Perhaps find or open an issue at https://github.com/ionic-team/cordova-res

@quinton-ashley
Copy link

I had to run the permission change recursively on the directory of the package I was trying to rebuild sudo chmod -R 777

@bilal-korir
Copy link

Upgrading to NPM 7+ solved the problem for me

@davidpharrington
Copy link

do you mean sudo npm install -g --unsafe-perm node-gyp

Try using the sudo chmod 777 command for the node_modules directory and if that doesn't work try
sudo npm install -g --unsafe-perm node-gyp
or
sudo node-gyp rebuild -g --unsafe-perm

@cclauss
Copy link
Contributor

cclauss commented Aug 19, 2021

@nodejs nodejs locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ERR! node-gyp -v < v10.x.x npm install -g npm
Projects
None yet
Development

No branches or pull requests