Answer the question
In order to leave comments, you need to log in
How to properly install node addons with native code?
The problem pops up every time I try to install a non-standard (unpopular) module for node/io.js.
Its essence is simple: I write (windows 7 x64)
npm install smth
... many errors...
.\src\glfw.cc(82): error C3861: 'NewSymbol': identifier not found [C:\Document
and Settings\user\1\node_modules\node-glfw\build\glfw .vcxproj]
... many errors ...
C:\Documents and Settings\user\1\node_modules\node-glfw\node_modules\nan\nan.h(
746): error C3861: 'NewSymbol': identifier not found [ C:\Documents and Settings
\user\1\node_modules\node-glfw\build\glfw.vcxproj]
C:\Documents and Settings\user\1\node_modules\node-glfw\node_modules\nan\nan.h(
750) : error C2039: 'NewSymbol' : is not a member of 'v8::String' [C:\Documents
and Settings\user\1\node_modules\node-glfw\build\glfw.vcxproj]
... many errors .. .
(I can provide all the output if needed)
Answer the question
In order to leave comments, you need to log in
Regarding the working environment:
I would recommend leaving Win XP at least for Win 7. From personal experience - if you suddenly have a problem installing a module on Win XP, no one will even bother to help you with debugging.
I would also recommend Visual Studio 2010 or 2013. In most cases, there will be no difference here. After choosing the version to use, I advise you to register npm config set msvs_version 2013
(or 2010, respectively)
It is worth reading the recommendations given in the instructions for working with node-gyp
Installing native modules in iojs is another story. The chance that they will be compiled as submodules of some project is zero, since node-gyp cannot compile under iojs, because it does not know where to download its sources from. Therefore, you will most likely have to install these modules separately, compile them, and then throw them into the project folder.
To compile, use npm install -g pan-gyp
. It's a fork of node-gyp specifically for compiling under iojs. Actually, to compile the module:
1. take it from the github
2. in package.json
the section we scripts
prescribe preinstall: pan-gyp rebuild
. (In the case of the module with which you are suffering, we overwrite the install script immediately)
3. From the module directory, runnpm install .
Some native modules do have compiled binaries, but that is entirely the responsibility of the module developer. And the responsibility is not small either. In the case of your module, there are no such binaries. Most often, if there are binaries, the module will have node-pre-gyp
. (Examples v8-profiler , v8-debug ).
By the way, for the examples given, you don't have to overwrite anything at all.
These two modules are sub-modules of node-inspector and install without problems in most cases.
In conclusion:
If you do not want to startle when native modules appear in the project dependencies, then I advise you to really use nodejs, since compilation under iojs is still very unstable in terms of tools.
The module you're struggling with most likely hasn't been tested for iojs at all.
Also pay attention to the package.json engine in this project.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question