Installing node-ffi on Windows
我正在尝试在Windows开发计算机上安装node-ffi,但是安装失败。 根据node-ffi网页,应该支持Windows。 但是,看来gyp试图通过" sh"执行某件事,(显然)我的系统中不存在。 有任何想法吗?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | D:\code\ffi-test>npm install node-ffi npm http GET https://registry.npmjs.org/node-ffi npm http 304 https://registry.npmjs.org/node-ffi npm http GET https://registry.npmjs.org/bindings npm http 304 https://registry.npmjs.org/bindings > [email protected] install D:\code\ffi-test ode_modules ode-ffi > node-gyp rebuild D:\code\ffi-test ode_modules ode-ffi>node"D:\Program Files odejs ode_module s pm\bin ode-gyp-bin\\..\.. ode_modules ode-gyp\bin ode-gyp.js" rebuild gyp http GET http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz gyp http 200 http://nodejs.org/dist/v0.10.13/node-v0.10.13.tar.gz gyp http GET http://nodejs.org/dist/v0.10.13/node.lib gyp http GET http://nodejs.org/dist/v0.10.13/x64/node.lib gyp http GET http://nodejs.org/dist/v0.10.13/node.lib gyp http GET http://nodejs.org/dist/v0.10.13/x64/node.lib gyp http 200 http://nodejs.org/dist/v0.10.13/node.lib gyp http 200 http://nodejs.org/dist/v0.10.13/node.lib gyp http 200 http://nodejs.org/dist/v0.10.13/x64/node.lib gyp http 200 http://nodejs.org/dist/v0.10.13/x64/node.lib sh gjenkjennes ikke som en intern eller ekstern kommando, kj?rbart program eller satsvis fil. gyp: Call to 'sh libffi-config.sh' returned exit status 1. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: `gyp` failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (D:\Program Files odejs ode_module s pm ode_modules ode-gyp\lib\configure.js:415:16) gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789: 12) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command"node""D:\\Program Files\ odejs\ ode_modules\ pm\ ode_modu les\ ode-gyp\\bin\ ode-gyp.js""rebuild" gyp ERR! cwd D:\code\ffi-test ode_modules ode-ffi gyp ERR! node -v v0.10.13 gyp ERR! node-gyp -v v0.10.2 gyp ERR! not ok unbuild [email protected] npm ERR! weird error 1 npm ERR! not ok code 0 D:\code\ffi-test> |
我的系统是Windows 7 x64。
在cmd中根据您的版本将Visual Studio路径设置为
1 2 3 4 5 | Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS% Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS% Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS% |
检查python是否已安装和配置。
需要Python版本<3
然后在cmd中使用命令
1 | npm install ffi |
安装ffi。
有关更多帮助,请参阅
无法在Windows 7 x64 / VS2012上安装需要编译的节点模块
对于Visual Studio 2017,请在Powershell中尝试此操作以设置环境变量
1 | set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\ |
然后运行npm命令
1 | npm install ffi |
你试过了吗
1 | npm install ffi |
观看文档:
https://github.com/rbranson/node-ffi