windows下尝试编写node模块
1,首先参考http://www.cnblogs.com/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\Roamin
g\npm\node_modules\node-gyp\bin\node-gyp.js
node-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, iss
tream@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-gyp
node@0.12.0
F:\Program Files\nodejs\mymodule>node-gyp configure build
再次执行,又莫名其妙失败。说是缺少python定义
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@0.12.0 | 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
设置好后,运行 ,这个错误没了
但是又多了个莫名其妙的错误 !
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@0.12.0 | win32 | x64
gyp http GET https://nodejs.org/dist/v0.12.0/node-v0.12.0.tar.gz
gyp http 200 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 200 https://nodejs.org/dist/v0.12.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/dist/v0.12.0/x64/node.lib
gyp http 200 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 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 _socket
ImportError: DLL load failed: 找不到指定的程序。
gyp ERR! configure error
gyp ERR! stack Error: `gyp` 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>
后来俺换了一个python27,终于没有了socket的错误
但是编译又出了一堆v8的错误!
F:\Program Files\nodejs\mymodule>node-gyp configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@0.12.0 | 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' ]
在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/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\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(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::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(13): error C2227: left of '->GetFunction' must point to class/struct/union/generic type [F:\Program Files\nodejs\mymodule\build\hello.vcxpro
j]
..\1.cpp(12): 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
windows下尝试编写node模块的更多相关文章
- Windows下如何更新 node.js
因为在Windows下是没有n模块的并不支持npm install -g n n latest更新,所以只能老老实实安装 1.在Path环境变量下查看自己的node.js安装路径 计算机-属性-高级 ...
- 配置 Windows 下的 nodejs C++ 模块编译环境 安装 node-gyp
配置 Windows 下的 nodejs C++ 模块编译环境 根据 node-gyp 指示的 Windows 编译环境说明, 简单一句话就是 "Python + VC++ 编译环境&quo ...
- windows下pip安装python模块时报错
windows下pip安装python模块时报错总结 装载于:https://www.cnblogs.com/maxaimee/p/6515165.html 前言: 这几天把python版本升级后, ...
- 二、Windows 下 ShellCode 编写初步
第二章.Windows 下 ShellCode 编写初步 (一)shellcode 定义:最先的 Shell 指的是人机交互界面,ShellCode 是一组能完成我们想要的功能的机器代码,通常以十六进 ...
- windows下pip安装python模块时报错【转】
windows下pip安装python模块时报错总结 请给作者点赞--> 原文链接 1 权限问题 C:\Users\ljf>pip install xlwt Exception: Trac ...
- windows下使用cpanm进行模块安装
windows下使用cpanm进行模块安装 要放假了,突然想整理一下手头上的软件,突然发现perl的安装模块这个功能不能用. 弄了一下,使得windows 下 perl 的 cpanm能用,避免成天为 ...
- webRTC脱坑笔记(四)— windows下Nginx对Node服务的反向代理
Nginx反向代理 1.什么是反向代理 当我们有一个服务器集群,并且服务器集群中的每台服务器的内容一样的时候,同样我们要直接从个人电脑访问到服务器集群服务器的时候无法访问,必须通过第三方服务器才能访问 ...
- Windows下尝试PHP7提示丢失VCRUNTIME140.DLL的问题解决
前天PHP7.0.0正式版发布了,有一些比较好的改进,官方也说速度比php5.6快了两倍,性能上有了很大提升,并且也发布了从php5.x向php7迁移的问题,所以今后php网站迁移后能够大幅度的提升网 ...
- Windows下Apache添加SSL模块
参考资料:http://www.yuansir-web.com/2011/05/12/hello-world/测试环境:windows2003 32位 + Apache2.4 + PHP5.4 一.准 ...
随机推荐
- 参数优化-API
网格搜索 对给定参数进行组合,用某标准进行评价,只适合小数据集 class sklearn.model_selection.GridSearchCV(estimator, param_grid, sc ...
- 牛客第二场 J farm
White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The pl ...
- python自学第5天,集合,文件读写
#!/usr/bin/env python #-*- coding:utf-8 -*- # Author:Hunter Yi s={1,1,1,2,3,4,5} print(s) #集合,去重 #关系 ...
- 再谈kbmMW垃圾回收
很早就写了关于kbmMW Server如何实现的垃圾回收,但最近一段时间还是为此遇到问题,实现的Server不能稳定运行,发生问题后不响应客户端的查询请求,在客户端得到服务端返回地址错误信息,只能重启 ...
- python 时间戳转换格式
1.简介 在编写代码时,往往涉及时间.日期.时间戳的相互转换. 2.示例 # 引入模块 import time, datetime 2.1 str类型的日期转换为时间戳 1 # 字符类型的时间 2 t ...
- iOS原生和React-Native之间的交互1
今天,记录一下iOS原生和React-Native之间的交互.如果第一次接触最好先移步至 http://www.cnblogs.com/shaoting/p/6388502.html 先看一下怎么在i ...
- element.dataset API
不久之前我向大家展示了非常有用的classList API,它是一种HTML5里提供的原生的对页面元素的CSS类进行增.删改的接口,完全可以替代jQuery里的那些CSS类操作方法.而另外一个非常有用 ...
- spring-dao.xml配置问题(一)
问题描述:对mapper扫描器进行配置时,sqlSessionFactory依赖报错 <!-- 配置sqlSessionFactory --> <bean id="sqlS ...
- selenium的webdriver三种等待方式(显式等待WebDriverWait+implicitly_wait隐式等待+sleep强制等待)
隐式等待是等页面加载,不是等元素!!! 1.显式等待 一个显式等待是你定义的一段代码,用于等待某个条件发生然后再继续执行后续代码.显式等待是等元素加载!!! 2.隐式等待,相当于设置全局的等待,在定位 ...
- Android SO动态调试之IDA
1.上传并启动android_server(IDA的dbgsrv目录) 2.设置端口转发:adb forward tcp:23946 tcp:23946 3.调试模式启动应用:adb shell am ...