gpt4 book ai didi

c++ - 为什么 npm install ffi 返回错误。使用 Node 版本 12

转载 作者:太空狗 更新时间:2023-10-29 22:54:20 42 4
gpt4 key购买 nike

我是 nodejs 的新手。我正在尝试从 node-js 调用 dll 中的 c++ API。到目前为止我发现可以使用 ffi 来完成它。我按照安装说明安装了必要的构建工具。但是当我运行 npm install ffi 时,出现以下错误。

我做错了什么吗?

**d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(222): error C2661: 'v8::Value:
:BooleanValue': no overloaded function takes 0 arguments**
[D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node
_modules\ref\build\binding.vcxproj]
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(253): error C2660: 'v8::Value:
:Uint32Value': function does not take 0 arguments [D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_module
s\ref\build\binding.vcxproj]
c:\users\nikhe\.node-gyp\12.0.0\include\node\v8.h(2567): note: see declaration of 'v8::Value::Uint32Value' (compiling
source file ..\src\binding.cc)
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(360): error C2664: 'v8::String
::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v8::Value>' to 'const
v8::String::Utf8Value &' [D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_modules\ref\build\binding.vcxp
roj]
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(360): note: Reason: cannot c
onvert from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value'
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(360): note: No user-defined-
conversion operator available that can perform this conversion, or the operator cannot be called
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(447): error C2664: 'v8::String
::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v8::Value>' to 'const
v8::String::Utf8Value &' [D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_modules\ref\build\binding.vcxp
roj]
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(447): note: Reason: cannot c
onvert from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value'
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(447): note: No user-defined-
conversion operator available that can perform this conversion, or the operator cannot be called
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(521): error C2660: 'v8::Value:
:Uint32Value': function does not take 0 arguments [D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_module
s\ref\build\binding.vcxproj]
c:\users\nikhe\.node-gyp\12.0.0\include\node\v8.h(2567): note: see declaration of 'v8::Value::Uint32Value' (compiling
source file ..\src\binding.cc)
d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\ref\src\binding.cc(550): error C2660: 'v8::Value:
:Uint32Value': function does not take 0 arguments [D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_module
s\ref\build\binding.vcxproj]
.
.
.
. d:\codelathe\electronpoc\practice\dll\electroncallingdll\node_modules\nan\nan_maybe_43_inl.h(117): note: see declarat
ion of 'Nan::ForceSet'
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:196:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\node_modules\ref
gyp ERR! node -v v12.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open 'D:\CodeLathe\ElectronPOC\Practice\dll\ElectroncallingDll\package.json'
npm WARN ElectroncallingDll No description
npm WARN ElectroncallingDll No repository field.
npm WARN ElectroncallingDll No README data
npm WARN ElectroncallingDll No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ref@1.3.5 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ref@1.3.5 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nikhe\AppData\Roaming\npm-cache\_logs\2019-05-31T10_07_30_614Z-debug.log

最佳答案

是因为node-ffi不支持node 12这是他们的 github 上打开的问题之一:https://github.com/node-ffi/node-ffi/issues/545

关于c++ - 为什么 npm install ffi 返回错误。使用 Node 版本 12,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56393529/

42 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com