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 一.准 ...
随机推荐
- Linux alias别名命令
首先介绍一下命令的别名,怎么查看的呢? 咱们使用which命令就可以查看的到它完整的命令是怎样的 [root@master ~]# which ls alias ls='ls --color=auto ...
- [转]linux shell 多线程实现
情景 shell脚本的执行效率虽高,但当任务量巨大时仍然需要较长的时间,尤其是需要执行一大批的命令时.因为默认情况下,shell脚本中的命令是串行执行的.如果这些命令相互之间是独立的,则可以使用“并发 ...
- HTC脚本介绍和入门示例
一.简介 HTC脚本全称是Html Companent即html组件,个人认为它是为了在开发动态HTML中实现代码重用和页面共享目的,主要是把“行为”作为组件封装,可以在很大程度上简化DHTML的开发 ...
- 第七十七课 最小生成树(Kruskal)
添加kruskal算法: #ifndef GRAPH_H #define GRAPH_H #include "Object.h" #include "SharedPoin ...
- centos 安装thrift
Thrift介绍 Thrift是一个软件框架,用来进行可扩展且跨语言的服务的开发.它结合了功能强大的软件堆栈和代码生成引擎,以构建在 C++, Java, Python, PHP, Ruby, Erl ...
- JavaScript循环语句-6---for语句,while语句的应用逻辑
JavaScript循环语句 学习目标 1.掌握for语句的语法结构 2.掌握for语句的应用逻辑 for语句 语法: For(语句1:语句2:语句3){ 被执行的代码块: } 语句1:在循环(代码块 ...
- python代理可用检测、代理类型检测
#coding:utf-8 import urllib2 def url_user_agent(proxy,url): proxy_support = urllib2.ProxyHandler({'h ...
- Putty CentOS SSH 总是自动断开连接
/********************************************************************** * Putty CentOS SSH 总是自动断开连接 ...
- JavaBasic_08
类的定义 [修饰符] calss 类名 [extends 父类名] [implements 接口名] { [成员变量声明;] [成员方法声明;] } 注:[]里面的东西不是必须的. 同一个java文件 ...
- 九度OJ-1112-导弹拦截-最长不增子序列
题目1112:拦截导弹 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:5218 解决:2603 题目描述: 某国为了防御敌国的导弹袭击,开发出一种导弹拦截系统.但是这种导弹拦截系统有一个缺 ...