[solved] gyp ERR! stack Error: EACCES: permission denied, mkdir

created at 08-17-2021 views: 19


sudo npm i --unsafe-perm


Still a permission issue

That is to say, npm does not support running as a root user for security reasons. Even if you run as a root user, npm will automatically switch to a user named nobody to run, and this user has almost no permissions. 

In this case, if there are some operations that require permissions in your script, such as writing files (especially writing /root/.node-gyp), the connection will be dropped.

In order to avoid this situation, rather create a high-privileged user to run npm in accordance with the rules of npm; or add the --unsafe-perm parameter at the end of your command so that it will not jump to no one, which one is running? Which user is the user, that is, root.

created at:08-17-2021
edited at: 08-17-2021: