1, first refer to Http://www.cnblogs.com/yupeng/p/3469444.html wrote a module
2. Run as directed
F:\Program files\nodejs\mymodule>node-gyp Configure Build
Grandma's, the beginning of a node-gyp, the internet a ship, it is also a module
' Node-gyp ' is not an internal or external command, nor is it a running program
or batch file.
F:\Program files\nodejs\mymodule>npm install-g node-gyp
Install the module, success!
C:\Users\cutepig\AppData\Roaming\npm\node-gyp, C:\Users\cutepig\AppData\Roamin
G\npm\node_ Modules\node-gyp\bin\node-gyp.js
[email protected] C:\Users\cutepig\AppData\Roaming\npm\node_modules\ Node-gyp
├──[email protected]
├──[email protected] ([email protected], [email Protected])
├──[email protected]
├──[email protected] ([email protected])
├──[email protected] ([email protected])
├──[email protected] ([email protected], [email Protected])
├──[email protected] ([email protected], [email protected])
├──[email Protected] ([email protected])
├──[email protected] ([email protected], [email protected], [email protected], [email protected])
├──[email protected] ([email protected])
├──[email protected] ([email protected], [email protected])
├──[email protected] ([email protected], [email protected], [email protected])
├──[email protected] ([email protected])
└──[email protected] ([email protected], [email protected], [email protected]
, [email protected], [email protected], [email protected], [email protected], ISS
[Email protected], [email protected], [email protected], [email protected], [email protected],
[Email protected], [email protected], [email protected], [email protected], [email protected]
0.3, [email protected], [email protected], [email protected], [email protected])
F:\Program files\nodejs\mymodule>Node-gyp
Usage:node-gyp <command> [Options]
Where <command> is one of:
-Build-invokes ' MSBuild ' and builds the module
-Clean-removes any generated build files and the ' Out ' dir
-Configure-generates MSVC project files for the current module
-Rebuild-runs "clean", "Configure" and "build" all at once
-Install-install node development files for the specified node version.
-List-prints A listing of the currently installed node development files
-Remove-removes the node development files for the specified version
[Email protected] C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp
[Email protected]
F:\Program files\nodejs\mymodule>node-gyp Configure Build
Executed again, and somehow failed. Said to be missing a Python definition
Gyp Info It worked if it ends with OK
Gyp info using [email protected]
Gyp info using [email protected] | Win32 | x64
Gyp err! Configure Error
Gyp err! Stack Error:can ' t find python executable "python", you Can set the PYT
HON env variable.
Gyp err! Stack at Failnopython (C:\Users\cutepig\AppData\Roaming\npm\node_mo
DULES\NODE-GYP\LIB\CONFIGURE.JS:401:14)
Gyp err! Stack at C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp
\lib\configure.js:356:11
Gyp err! Stack at Fsreqwrap.oncomplete (fs.js:99:15)
Gyp err! System Windows_NT 6.1.7601
Gyp err! Command "Node" "C:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules
\\node-gyp\\bin\\node-gyp.js "" Configure "" Build "
Gyp err! CWD F:\Program Files\nodejs\mymodule
Gyp err! Node-v v0.12.0
Gyp err! Node-gyp-v v3.3.1
Gyp err! Not OK
F:\Program files\nodejs\m
F:\Program files\nodejs\mymodule>Set Python=f:\sw\python27\python.exe
F:\Program files\nodejs\mymodule>node-gyp Configure Build
Set up, run, this error is gone
But there is a more inexplicable mistake!
Gyp Info It worked if it ends with OK
Gyp info using [email protected]
Gyp info using [email protected] | Win32 | x64
Gyp http GET https://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gz
Gyp http https://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gz
Gyp http GET https://nodejs.org/dist/v0.12.0/SHASUMS256.txt
Gyp http GET https://nodejs.org/dist/v0.12.0/x64/node.lib
Gyp http GET https://nodejs.org/dist/v0.12.0/node.lib
Gyp http Https://nodejs.org/dist/v0.12.0/SHASUMS256.txt
Gyp http Https://nodejs.org/dist/v0.12.0/x64/node.lib
Gyp http Https://nodejs.org/dist/v0.12.0/node.lib
Gyp Info Spawn F:\sw\Python27\python.exe
Gyp info Spawn args [' c:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\
Node-gyp\\gyp\\gyp_main.py ',
Gyp info spawn args ' Binding.gyp ',
Gyp info Spawn args '-f ',
Gyp info spawn args ' MSVs ',
Gyp info Spawn args '-G ',
Gyp info spawn args ' Msvs_version=auto ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' F:\\program files\\nodejs\\mymodule\\build\\config.gypi ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' c:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\
Node-gyp\\addon.gypi ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' C:\\users\\cutepig\\.node-gyp\\0.12.0\\common.gypi ',
Gyp info spawn args '-dlibrary=shared_library ',
Gyp info spawn args '-dvisibility=default ',
Gyp info spawn args '-dnode_root_dir=c:\\users\\cutepig\\.node-gyp\\0.12.0 ',
Gyp info spawn args '-dnode_gyp_dir=c:\\users\\cutepig\\appdata\\roaming\\npm\
\node_modules\\node-gyp ',
Gyp info spawn args '-dnode_lib_file=node.lib ',
Gyp info spawn args '-dmodule_root_dir=f:\\program files\\nodejs\\mymodule ',
Gyp info spawn args '--depth=. ',
Gyp info spawn args '--no-parallel ',
Gyp info spawn args '--generator-output ',
Gyp info spawn args ' F:\\program files\\nodejs\\mymodule\\build ',
Gyp info spawn args '-goutput_dir=.
Traceback (most recent):
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.
Py ", line +, in <module>
Sys.exit (Gyp.script_main ())
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\__init__.py ", line 545, in Script_main
Return main (sys.argv[1:])
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\__init__.py ", line 538, in main
Return Gyp_main (args)
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\__init__.py ", line 514, in Gyp_main
Options.duplicate_basename_check)
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\__init__.py ", line, in Load
Generator = __import__ (Generator_name, Globals (), locals (), generator_name)
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\generator\msvs.py ", line A, in <module>
Import Gyp. Msvsuserfile as Msvsuserfile
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\pylib\gyp
\msvsuserfile.py ", line 9, in <module>
Import Socket # for GetHostName
File "F:\sw\Python27\lib\socket.py", line A, in <module>
Import _socket
Importerror:dll load Failed: The specified program could not be found.
Gyp err! Configure Error
Gyp err! Stack Error: ' ' failed with exit Code:1
Gyp err! Stack at Childprocess.oncpexit (C:\USERS\CUTEPIG\APPDATA\ROAMING\NP
M\NODE_MODULES\NODE-GYP\LIB\CONFIGURE.JS:305:16)
Gyp err! Stack at Childprocess.emit (events.js:110:17)
Gyp err! Stack at Process.childprocess._handle.onexit (child_process.js:1067
: 12)
Gyp err! System Windows_NT 6.1.7601
Gyp err! Command "Node" "C:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules
\\node-gyp\\bin\\node-gyp.js "" Configure "" Build "
Gyp err! CWD F:\Program Files\nodejs\mymodule
Gyp err! Node-v v0.12.0
Gyp err! Node-gyp-v v3.3.1
Gyp err! Not OK
F:\Program files\nodejs\mymodule>
Later I changed a python27, finally did not have the socket error
But compiled a bunch of V8 errors!
F:\Program Files\nodejs\mymodule>node-gyp Configure Build
Gyp Info It worked if it ends with OK
Gyp info using [email protected]
Gyp info using [email protected] | Win32 | x64
Gyp Info Spawn F:\Python27\python.exe
Gyp info Spawn args [' c:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py ',
Gyp info spawn args ' Binding.gyp ',
Gyp info Spawn args '-f ',
Gyp info spawn args ' MSVs ',
Gyp info Spawn args '-G ',
Gyp info spawn args ' Msvs_version=auto ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' F:\\program files\\nodejs\\mymodule\\build\\config.gypi ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' C:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\node-gyp\\addon.gypi ',
Gyp info Spawn args '-I ',
Gyp info spawn args ' C:\\users\\cutepig\\.node-gyp\\0.12.0\\common.gypi ',
Gyp info spawn args '-dlibrary=shared_library ',
Gyp info spawn args '-dvisibility=default ',
Gyp info spawn args '-dnode_root_dir=c:\\users\\cutepig\\.node-gyp\\0.12.0 ',
Gyp info spawn args '-dnode_gyp_dir=c:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\node-gyp ',
Gyp info spawn args '-dnode_lib_file=node.lib ',
Gyp info spawn args '-dmodule_root_dir=f:\\program files\\nodejs\\mymodule ',
Gyp info spawn args '--depth=. ',
Gyp info spawn args '--no-parallel ',
Gyp info spawn args '--generator-output ',
Gyp info spawn args ' F:\\program files\\nodejs\\mymodule\\build ',
Gyp info spawn args '-goutput_dir=.
Gyp info Spawn C:\Program Files (x86) \msbuild\12.0\bin\msbuild.exe
Gyp info Spawn args [' Build/binding.sln ',
Gyp info spawn args '/clp:verbosity=minimal ',
Gyp info spawn args '/nologo ',
Gyp info spawn args '/p:configuration=release; Platform=x64 ']
Build one project at a time in this solution. To enable parallel builds, add the "/M" switch.
1.cpp
.. \1.cpp (6): Error c4430:missing type Specifier-int assumed. Note:c++ does not support Default-int [F:\Program Files\nodejs\mymodule\build\hello.
Vcxproj
.. \1.cpp (6): Error C2143:syntax error:missing ', ' Before ' & ' [F:\Program files\nodejs\mymodule\build\hello.vcxproj]
.. \1.cpp (7): Error C2248: ' V8::handlescope::handlescope ': Cannot access protected member declared in class ' V8::handlescope ' [F:\Program Files\nodej
S\mymodule\build\hello.vcxproj]
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h (816): See Declaration of ' V8::handlescope::handlescope '
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h (+): See Declaration of ' V8::handlescope '
.. \1.cpp (8): Error C2039: ' Close ': is not a member of ' V8::handlescope ' [F:\Program files\nodejs\mymodule\build\hello.vcxpr Oj
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h (+): See Declaration of ' V8::handlescope '
.. \1.cpp (8): Error C2039: ' New ': is not a member of ' v8::string ' [F:\Program files\nodejs\mymodule\build\hello.vcxproj]
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h (1599): See Declaration of ' v8::string '
.. \1.cpp (8): Error C3861: ' New ': identifier not found [F:\Program files\nodejs\mymodule\build\hello.vcxproj]
.. \1.cpp: Error C2039: ' Newsymbol ': is not a member of ' v8::string ' [F:\Program files\nodejs\mymodule\build\hello.vcxpr Oj
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h (1599): See Declaration of ' v8::string '
.. \1.cpp: Error C2664: ' v8::local<v8::functiontemplate> v8::functiontemplate::new (v8::isolate *,v8:: Functioncallback,v8::handle<v8::value>,v8::ha
Ndle<v8::signature>,int) ': cannot convert argument 1 from ' v8::handle<v8::value> (__cdecl *) (const int) ' to ' V8::isolate * ' [F:\Program Files\nodejs
\mymodule\build\hello.vcxproj]
There is no context in which this conversion is possible
.. \1.cpp: Error c2227:left of '->getfunction ' must point to class/struct/union/generic type [F:\Program files\nodejs \mymodule\build\hello.vcxpro
J
.. \1.cpp: Error C3861: ' newsymbol ': identifier not found [F:\Program files\nodejs\mymodule\build\hello.vcxproj]
Gyp err! Build Error
Gyp err! Stack Error: ' C:\Program Files (x86) \msbuild\12.0\bin\msbuild.exe ' failed with exit Code:1
Gyp err! Stack at Childprocess.onexit (c:\users\cutepig\appdata\roaming\npm\node_modules\node-gyp\lib\build.js:276:23)
Gyp err! Stack at Childprocess.emit (events.js:110:17)
Gyp err! Stack at Process.childprocess._handle.onexit (child_process.js:1067:12)
Gyp err! System Windows_NT 6.1.7601
Gyp err! Command "Node" "C:\\users\\cutepig\\appdata\\roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "Configure" " Build
Gyp err! CWD F:\Program Files\nodejs\mymodule
Gyp err! Node-v v0.12.0
Gyp err! Node-gyp-v v3.3.1
Gyp err! Not OK
Trying to write a node module under Windows