Fixing node-gyp: Permission Denied when running as root

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.

 

How to stop NodeJS Mocha unit testing console beeping

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:

http://superuser.com/questions/10575/turning-off-the-cmd-window-beep-sound

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:

  1. Right-click My Computer and select Manage.
  2. Expand System Tools and select Device Manager.
  3. From the View menu, select Show hidden devices.
  4. Expand Non-Plug and Play Drivers.
  5. Right-click Beep, and select Properties.
  6. Select the Drivers tab.
  7. Click Stop. You can also change the start-up type to Disabled so the beep service never starts.