This node-gyp permission denied issue happens when, as the root user, you globally install node modules that require compilation with node-gyp. As root is the default user on Digital Ocean this seems to affect many people and should probably be fixed at the root cause.
Luckily there is a pretty simple workaround for this:
npm config set user 0
The other solution is to create a regular user and install everything as them. This is safer as installing modules as root means they could do anything to your system. I’d recommend installing all node modules as a normal user without root access if you’re on a machine with anything important on it.
Thought I’d create this post to save others the 20 minutes I wasted wondering why NodeJS and Mocha Tests were making my console bleep over and over.
The problem isn’t with node, it’s with windows console beeping whenever the console.error command is sent to it (I believe).
You can disable the bleeping by following the instructions here:
The instructions are also below in case this link is ever broken in the future:
The Windows command line command “net stop beep” will turn off the beeping, and “net start beep” will turn on the beeping.
And how to disable it permanently:
- Right-click My Computer and select Manage.
- Expand System Tools and select Device Manager.
- From the View menu, select Show hidden devices.
- Expand Non-Plug and Play Drivers.
- Right-click Beep, and select Properties.
- Select the Drivers tab.
- Click Stop. You can also change the start-up type to Disabled so the beep service never starts.