node gyp 安装-gyp build失败,不知道什么原因

windows下尝试编写node模块 - cutepig - 博客园
随笔 - 699, 文章 - 1, 评论 - 232, 引用 - 0
1,首先参考/yupeng/p/3469444.html写了一个模块
2,按照指引运行
F:\Program Files\nodejs\mymodule&node-gyp configure build
奶奶的,一开始就少了一个node-gyp,上网一艘,原来这也是一个模块
'node-gyp' 不是内部或外部命令,也不是可运行的程序或批处理文件。
F:\Program Files\nodejs\mymodule&npm install -g node-gyp
安装模块,成功!C:\Users\cutepig\AppData\Roaming\npm\node-gyp -& C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.jsnode-gyp@3.3.1 C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp├── graceful-fs@4.1.3├── osenv@0.1.3 (os-tmpdir@1.0.1, os-homedir@1.0.1)├── semver@5.1.0├── nopt@3.0.6 (abbrev@1.0.7)├── fstream@1.0.8 (inherits@2.0.1)├── which@1.2.4 (isexe@1.1.2, is-absolute@0.1.7)├── minimatch@1.0.0 (sigmund@1.0.1, lru-cache@2.7.3)├── mkdirp@0.5.1 (minimist@0.0.8)├── glob@4.5.3 (inherits@2.0.1, inflight@1.0.4, once@1.3.3, minimatch@2.0.10)
├── rimraf@2.5.2 (glob@7.0.3)├── tar@2.2.1 (inherits@2.0.1, block-stream@0.0.8)├── npmlog@2.0.2 (ansi@0.3.1, gauge@1.2.7, are-we-there-yet@1.0.6)├── path-array@1.0.1 (array-index@1.0.0)└── request@2.69.0 (is-typedarray@1.0.0, aws-sign2@0.6.0, forever-agent@0.6.1, caseless@0.11.0, stringstream@0.0.5, tunnel-agent@0.4.2, oauth-sign@0.8.1, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, node-uuid@1.4.7, qs@6.0.2, combined-stream@1.0.5, tough-cookie@2.2.1, mime-types@2.1.10, aws4@1.3.2, bl@1.0.3, form-data@1.0.0-rc3, hawk@3.1.3, har-validator@2.0.6, http-signature@1.1.1)
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
node-gyp@3.3.1
C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gypnode@0.12.0
F:\Program Files\nodejs\mymodule&node-gyp configure build
再次执行,又莫名其妙失败。说是缺少python定义
gyp info it worked if it ends with okgyp info using node-gyp@3.3.1gyp info using node@0.12.0 | win32 | x64gyp ERR! configure errorgyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.gyp ERR! stack
at failNoPython (C:\Users\cutepig\AppData\Roaming\npm\node_modules\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:11gyp ERR! stack
at FSReqWrap.oncomplete (fs.js:99:15)gyp ERR! System Windows_NT 6.1.7601gyp 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\mymodulegyp ERR! node -v v0.12.0gyp ERR! node-gyp -v v3.3.1gyp 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
设置好后,运行 ,这个错误没了&
但是又多了个莫名其妙的错误 !
gyp info it worked if it ends with okgyp info using node-gyp@3.3.1gyp info using node@0.12.0 | win32 | x64gyp http GET https://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gzgyp http 200 https://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gzgyp http GET https://nodejs.org/dist/v0.12.0/SHASUMS256.txtgyp http GET https://nodejs.org/dist/v0.12.0/x64/node.libgyp http GET https://nodejs.org/dist/v0.12.0/node.libgyp http 200 https://nodejs.org/dist/v0.12.0/SHASUMS256.txtgyp http 200 https://nodejs.org/dist/v0.12.0/x64/node.libgyp http 200 https://nodejs.org/dist/v0.12.0/node.libgyp info spawn F:\sw\Python27\python.exegyp 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 call last):
File "C:\Users\cutepig\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py", line 16, 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 91, 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 20, 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 47, in &module&
import _socketImportError: DLL load failed: 找不到指定的程序。gyp ERR! configure errorgyp ERR! stack Error: `gyp` failed with exit code: 1gyp ERR! stack
at ChildProcess.onCpExit (C:\Users\cutepig\AppData\Roaming\npm\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.7601gyp 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\mymodulegyp ERR! node -v v0.12.0gyp ERR! node-gyp -v v3.3.1gyp ERR! not ok
F:\Program Files\nodejs\mymodule&
后来俺换了一个python27,终于没有了socket的错误
但是编译又出了一堆v8的错误!
F:\Program Files\nodejs\mymodule&node-gyp configure buildgyp info it worked if it ends with okgyp info using node-gyp@3.3.1gyp info using node@0.12.0 | win32 | x64gyp info spawn F:\Python27\python.exegyp 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.exegyp info spawn args [ 'build/binding.sln',gyp info spawn args
'/clp:Verbosity=minimal',gyp info spawn args
'/nologo',gyp info spawn args
'/p:Configuration=RPlatform=x64' ]在此解决方案中一次生成一个项目。若要启用并行生成,请添加&/m&开关。
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\nodejs\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(800) : 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.vcxproj]
C:\Users\cutepig\.node-gyp\0.12.0\deps\v8\include\v8.h(800) : 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(12): error C2039: 'NewSymbol' : 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(13): error C2664: 'v8::Local&v8::FunctionTemplate& v8::FunctionTemplate::New(v8::Isolate *,v8::FunctionCallback,v8::Handle&v8::Value&,v8::Handle&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(13): error C2227: left of '-&GetFunction' must point to class/struct/union/generic type [F:\Program Files\nodejs\mymodule\build\hello.vcxproj]..\1.cpp(12): error C3861: 'NewSymbol': identifier not found [F:\Program Files\nodejs\mymodule\build\hello.vcxproj]gyp ERR! build errorgyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1gyp 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.7601gyp 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\mymodulegyp ERR! node -v v0.12.0gyp ERR! node-gyp -v v3.3.1gyp ERR! not oknode-gyp build失败,不知道什么原因_百度知道
node-gyp build失败,不知道什么原因
算实现都C++例Reno/HighSpeed/Vegas/Fast等拥塞控制算知道要实现内容 参看资料
来自团队:
其他类似问题
为您推荐:
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Fix ‘node-gyp rebuild’ error on windows |
Fix 'node-gyp rebuild' error on windows
While playing around with
I ran into some issues using a yoeman flux generator. It kept failing on “node-gyp rebuild”. If you do any development on Windows you’ve likely run into issues with node-gyp before. The core of the problem is that node-gyp is no longer being actively developed
and so it has some old dependencies that a modern development env might not have.
node-gyp rebuild failed
How to fix?
Goto Control Panel -& Programs and Features and uninstall “Microsoft Visual C++2010 x64 Redistributable” and “Microsoft Visual C++ 2010 x86 Redistributable” (if present)
Download and install
(if you have Python 3.x already installed, just leave it, both can coexist)
or Visual Studio 2010
IMPORTANT: The order of steps above is important!
Now open a command window/console and enter the following commands
npm config set python /Python27/python.exe --global
npm config set msvs_version 2010 --global
Final Step
Finally goto Start -& All Programs -& Microsoft Windows SDK v7.1 -& Windows SDK 7.1 Command Prompt
From this command window the `node-gyp rebuild` command will work.
NOTE: You only need to use the Windows SDK 7.1 Command Prompt when running `npm install`, once installed can go back to normal command window.
2 Pings/Trackbacks for "Fix ‘node-gyp rebuild’ error on windows"
Recent Posts
Categories求助npm install bcrypt问题,有关于node-gyp rebuild - CNode技术社区
这家伙很懒,什么个性签名都没有留下。
初学node.js,尝试运行node.js in action的代码出现了无法安装bcrypt module的问题,按照/?p=510
操作后还是有问题,希望能得到解答,十分感谢!
D:\node\nodejsinaction\9\shoutbox&npm install bcrypt
npm http GET
npm http 304
npm http GET
npm http 304
bcrypt.7.3 install D:\node\nodejsinaction\9\shoutbox\node_modules\bcrypt
node-gyp rebuild
D:\node\nodejsinaction\9\shoutbox\node_modules\bcrypt&node “D:\node_modules\npm
bin\node-gyp-bin\…\node_modules\node-gyp\bin\node-gyp.js” rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.InvalidPlatform
.Targets(23,7): error MSB8007: 项目“bcrypt_lib.vcxproj”的平台无效。平台为“x64
”。您会看到此消息的可能原
因是,您尝试在没有解决方案文件的情况下生成项目,并且为此项目指定了并不存在的非默
认平台。 [D:\node\nodejsinaction\9\shoutbox
\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\node_modules\npm\node_modules\node
-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command “node” “D:\node_modules\npm\node_modules\node-gyp\bin\nod
e-gyp.js” &rebuild&
gyp ERR! cwd D:\node\nodejsinaction\9\shoutbox\node_modules\bcrypt
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
npm ERR! bcrypt.7.3 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR! Failed at the bcrypt.7.3 install script.
npm ERR! This is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls bcrypt
问题就解决了
现在解决了没有,windows下c++真的是让人头疼。已经装了几次了都是不成功的。但是我们公司又没给我们配置更高的版本,心里无明的怒火。
换掉windows。。。
我用Ubuntu安装上了,stackoverflow上说要安装vs2015, 我本身就安装了编译还是出错,果断采用Linux
我安装的是vs2013,使用下面命令安装成功:
npm install -g bcrypt --msvs_version=2013
虽然有些警告,但是无视之。
怎么这么多版本…一个说12 13 15 10
我win10当初也是这种情况,后来看教程我安装了Python2.7
还安装了vs2015社区版,
然后就好了
自豪地采用
吧,无需编译
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
服务器赞助商为
,存储赞助商为
,由提供应用性能服务。
新手搭建 Node.js 服务器,推荐使用无需备案的node-gyp build的时候报“无法解析的外部符号”,实在是不知道如何解决了,来请教下大家 - CNode技术社区
积分: 1120
这家伙很懒,什么个性签名都没有留下。
win7,python2.7, vs2013, node0.12.7, node-gyp configure的时候没有问题,在执行node-gyp build的时候报错如图:
被这个问题困住了,请问怎么解决啊?谢谢!
node.h这个文件里有一些标识不认识,比如__declspec,请问怎么解决呢
这是程序在链接的时候出错找不到相关资源的
你源码编译node了吗
windows下总是有各种奇怪的问题~
编译了,是因为node.lib放在了Release文件夹下,而不是直接放在源码文件夹下导致找不到的。copy到源码文件夹下就正常了。windows下写代码的程序员上辈子都是折翼的天使
其实也不要那么黑win,我用webstorm写着好好的,发布到centos的生产服务器上也基本没问题。
自豪地采用
CNode 社区为国内最专业的 Node.js 开源技术社区,致力于 Node.js 的技术研究。
服务器赞助商为
,存储赞助商为
,由提供应用性能服务。
新手搭建 Node.js 服务器,推荐使用无需备案的}

我要回帖

更多关于 gyp err build error 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信