NPM – Can’t install socket.IO

At least one of the packages in Socket.IO’s dependency tree is a C/C++ addons which needs to be compiled on your system as it’s installed. And, since it’s a dependency, if it doesn’t succeed in installing, neither will Socket.IO.

To enable cross-system compilation, Node.js uses node-gyp as its build system. You’ll need to have it installed as a global package:

npm install -g node-gyp

As well as have its dependencies installed. Abridged version:

  • Python 2
  • C/C++ Compiler / Build Tools
    • For Windows, Microsoft Visual Studio 2013 (C++ or Windows Desktop) (Express edition)
      • For 64-bit, may need Windows 7 64-bit SDK

Then, you should be able to install Socket.IO as a local package so you can require it:

npm install socket.io

Leave a Comment