3

我正在尝试在我的 Windows 开发机器上安装 node-ffi,但安装失败。根据node-ffi 网页,应该支持 Windows。但是,似乎 gyp 正在尝试通过“sh”执行某些操作,这(显然)在我的系统上不存在。有任何想法吗?

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

> node-ffi@0.5.7 install D:\code\ffi-test\node_modules\node-ffi
> node-gyp rebuild


D:\code\ffi-test\node_modules\node-ffi>node "D:\Program Files\nodejs\node_module
s\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-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\nodejs\node_module
s\npm\node_modules\node-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\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\code\ffi-test\node_modules\node-ffi
gyp ERR! node -v v0.10.13
gyp ERR! node-gyp -v v0.10.2
gyp ERR! not ok
unbuild node-ffi@0.5.7
npm ERR! weird error 1
npm ERR! not ok code 0

D:\code\ffi-test>

我的系统是 Windows 7 x64。

4

3 回答 3

2

在 cmd 中根据您的版本设置 Visual Studio 路径为

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中使用命令

npm install ffi

安装 ffi 。如需更多帮助,请查看 无法在 Windows 7 x64/VS2012 上安装需要编译的节点模块

于 2015-07-03T11:01:31.323 回答
1

你试过吗

npm install ffi

观看文档: https ://github.com/rbranson/node-ffi

于 2013-12-23T13:26:32.823 回答
0

对于 Visual Studio 2017,请在 Powershell 中尝试此设置环境变量

set VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\

然后运行 ​​npm 命令

npm install ffi
于 2018-05-08T07:45:31.300 回答