0

when I try to install node-gyp into my node project in order to be able to install socket.io, I get these npm errors:

mac terminal

I have all the dependencies for node-gyp to be installed:

  • python (v2.7 recommended, v3.x.x is not supported) (already installed on Mac OS X)
  • Xcode - You also need to install the Command Line Tools via Xcode. You can find this under the menu Xcode -> Preferences -> Downloads This step will install gcc and the related toolchain containing make

Can anyone help me with this?

Thanks, Luke

LukeG
  • 53
  • 9

1 Answers1

2

It looks like you don't have permissions to write to /usr/local/lib/node_modules/node-gyp.

You could:

  • give write permissions to user LukeG on /usr/local/lib/node_modules/node-gyp: sudo chown -R LukeG /usr/local
  • rerun the install command using sudo

If it's your dev machine we're talking about I would go for the first option, since that's where you should install program libraries (http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/usr.html).

More on the subject: How/why does npm recommend not running as root?

Community
  • 1
  • 1
Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106
  • Perfect, thanks. This let me install node-gyp. Didn't know this was causing it. Now I encounter another problem though. Anytime I try to sudo npm install socket.io, I get these errors: [terminal](http://i.imgur.com/BlULf9E.png) . Should I provide you with builderror.log? – LukeG Jun 30 '15 at 14:01
  • 1
    I can't see any error there, it looks like normal `npm` output, unless there's something else at the bottom of the log, in that case the image is not showing it. If my answer solved your problem please consider accepting it. If you have a different problem the best thing is to open a new question. – Alberto Zaccagni Jun 30 '15 at 14:09