node-gyp build occur error
node -v : V8.11.1 npm -v : 6.0.0 compiler: windows7 I want to use the node to call C++ function, when I input the node-gyp configure ,it is not problem, Next, I input the "node-gyp build", occur an error: Your environment has been set up for using Node.js 8.11.1 (x64) and npm.
C:\Users\Administrator>e:
E:>cd node
E:\node>cd example1
E:\node\example1>node-gyp configure gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | win32 | x64 gyp info spawn C:\Python27\python.EXE gyp info spawn args [ 'C:\Users\Administrator\AppData\Roaming\npm\node_mod ules\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 'E:\node\example1\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\Administrator\AppData\Roaming\npm\node_mod ules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\Administrator\.node-gyp\8.11.1\include\nod e\common.gypi', gyp info spawn args '-Dlibrary=shared_library', gyp info spawn args '-Dvisibility=default', gyp info spawn args '-Dnode_root_dir=C:\Users\Administrator\.node-gyp\8.11 .1', gyp info spawn args '-Dnode_gyp_dir=C:\Users\Administrator\AppData\Roaming \npm\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\Users\Administrator\.node-gyp\8.11 .1\<(target_arch)\node.lib', gyp info spawn args '-Dmodule_root_dir=E:\node\example1', gyp info spawn args '-Dnode_engine=v8', gyp info spawn args '--depth=.', gyp info spawn args '--no-parallel', gyp info spawn args '--generator-output', gyp info spawn args 'E:\node\example1\build', gyp info spawn args '-Goutput_dir=.' ] gyp info ok
E:\node\example1>node-gyp 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 msbuild
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' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
hello.cc
win_delay_load_hook.cc
C:\Users\Administrator.node-gyp\8.11.1\x64\node.lib : fatal error LNK1107: inv
alid or corrupt file: cannot read at 0x21300A [E:\node\example1\build\addon.vcx
proj]
gyp ERR! build error
gyp ERR! stack Error: msbuild failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Users\Administrator\AppData\Roamin
g\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_proces
s.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Administrator
\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "build"
gyp ERR! cwd E:\node\example1
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
how to solve this problem? Thanks!
I recently downgraded to node version 6.11.0 and I stopped having issues with this...It might help with you too?
C:\Users\Administrator.node-gyp\8.11.1\x64\node.lib : fatal error LNK1107: inv alid or corrupt file: cannot read at 0x21300A [E:\node\example1\build\addon.vcx proj]
How big is that file? Offset 0x21300A is over 2 MB, which seems biggish for a .vcxproj file.
Can you post your binding.gyp?
Same issue here:
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
profiler.cc
cpu_profiler.cc
cpu_profile.cc
cpu_profile_node.cc
c:\git\imgpoolwebapp\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'int64_t' to 'double', possible loss of data (compiling source file ..\src\cpu_profile.cc) [C:\GIT\ImgPoolWebApp\nod
e_modules\v8-profiler\build\profiler.vcxproj]
..\src\cpu_profile.cc(82): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,int64_t>(A0)' being compiled
with
[
A0=int64_t
]
heap_profiler.cc
heap_snapshot.cc
heap_output_stream.cc
heap_graph_node.cc
..\src\heap_snapshot.cc(102): warning C4244: 'argument': conversion from 'int64_t' to 'uint32_t', possible loss of data [C:\GIT\ImgPoolWebApp\node_modules\v8-profiler\build\profiler.vcxproj]
..\src\heap_graph_node.cc(69): warning C4996: 'v8::Object::Has': was declared deprecated [C:\GIT\ImgPoolWebApp\node_modules\v8-profiler\build\profiler.vcxproj]
c:\users\z0034zpz\.node-gyp\8.11.2\include\node\v8.h(3171): note: see declaration of 'v8::Object::Has'
c:\git\imgpoolwebapp\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'std::size_t' to 'double', possible loss of data (compiling source file ..\src\heap_graph_node.cc) [C:\GIT\ImgPoolWe
bApp\node_modules\v8-profiler\build\profiler.vcxproj]
..\src\heap_graph_node.cc(126): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,std::size_t>(std::A0)' being compiled
with
[
A0=std::size_t
]
heap_graph_edge.cc
C:\Users\z0034zpz\.node-gyp\8.11.2\x64\node.lib : fatal error LNK1107: invalid or corrupt file: cannot read at 0x356735 [C:\GIT\ImgPoolWebApp\node_modules\v8-profiler\build\profiler.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\nodejs\\node.exe" "C:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\GIT\\ImgPoolWebApp\\node_modules\\v8-profiler\\build\\profiler\\v5.7.0\\node-v57-win32-x64\\profiler.node" "--module_name=profiler" "--module_path=C:\\GIT\\ImgPoolWebApp\\node_modules\\v8-profiler\\build\\profiler\\v5.7.0\\node-v57-win32-x64"
gyp ERR! cwd C:\GIT\ImgPoolWebApp\node_modules\v8-profiler
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Lot of libraries give me error: fatal error LNK1107: invalid or corrupt file: cannot read at 0x356735, when they are build.
closing this due to staleness, sorry, feel free to reopen or open a new issue if this shows up again