问题描述
我正在尝试将node-ffi作为软件包安装在我的一个电子应用程序中。 直接执行“ npm install node-ffi”失败了,所以我尝试了在此处找到的“ Source Install”部分:
https://github.com/node-ffi/node-ffi
到目前为止我所做的事情:
npm install --global windows-build-tools
这创建了以下文件夹:
PS C:\Users\jmk\.windows-build-tools> dir
Directory: C:\Users\jmk\.windows-build-tools
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2020-09-23 10:15 AM python27
-a---- 2020-09-23 10:15 AM 20246528 python-2.7.15.amd64.msi
-a---- 2020-09-23 11:06 AM 51992 python-log.txt
-a---- 2020-09-23 10:15 AM 1119848 vs_BuildTools.exe
您可以看到它安装了python2,但是我更改了node-gyp使用的默认python,如下所示:
PS C:\Users\jmk\source\github\node-ffi> npm config set python C:\python38\python.exe
然后像这样确认:
nPS C:\Users\jmk\source\github\node-ffi> node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.0
gyp info using node@12.18.4 | win32 | x64
gyp info find Python using Python version 3.8.5 found at "C:\python38\python.exe"
gyp info find VS using VS2019 (16.7.30503.244) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\python38\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\jmk\\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 '-I',gyp info spawn args 'C:\\Users\\jmk\\source\\github\\node-ffi\\build\\config.gypi',gyp info spawn args 'C:\\Users\\jmk\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',gyp info spawn args 'C:\\Users\\jmk\\AppData\\Local\\node-gyp\\Cache\\12.18.4\\include\\node\\common.gypi',gyp info spawn args '-Dlibrary=shared_library',gyp info spawn args '-Dvisibility=default',gyp info spawn args '-Dnode_root_dir=C:\\Users\\jmk\\AppData\\Local\\node-gyp\\Cache\\12.18.4',gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\jmk\\AppData\\Roaming\\npm\\node_modules\\node-gyp',gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\jmk\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\12.18.4\\\\<(target_arch)\\\\node.lib',gyp info spawn args '-Dmodule_root_dir=C:\\Users\\jmk\\source\\github\\node-ffi',gyp info spawn args '-Dnode_engine=v8',gyp info spawn args '--depth=.',gyp info spawn args '--no-parallel',gyp info spawn args '--generator-output',gyp info spawn args 'C:\\Users\\jmk\\source\\github\\node-ffi\\build',gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info ok
PS C:\Users\jmk\source\github\node-ffi>
现在,当我执行“ node-gyp构建”或重建时,我看到如下错误:
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(49,57): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\AppData\Local\node-gyp\Cache\12.18.4\include\node\v8.h(6126,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\ffi.cc) [C:\Users\jmk\source\github\node-ffi\build\ffi_bin
dings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(48,8): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(51,60): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\AppData\Local\node-gyp\Cache\12.18.4\include\node\v8.h(6126,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\ffi.cc) [C:\Users\jmk\source\github\node-ffi\build\ffi_bin
dings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(50,8): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(53,54): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\AppData\Local\node-gyp\Cache\12.18.4\include\node\v8.h(6126,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\ffi.cc) [C:\Users\jmk\source\github\node-ffi\build\ffi_bin
dings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(52,8): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(55,59): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
C:\Users\jmk\AppData\Local\node-gyp\Cache\12.18.4\include\node\v8.h(6126,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\ffi.cc) [C:\Users\jmk\source\github\node-ffi\build\ffi_bin
dings.vcxproj]
C:\Users\jmk\source\github\node-ffi\src\ffi.cc(54,8): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Users\jmk\source\github\node-ffi\build\ffi_bindings.vcxproj]
我试图找出第一个错误。这是ffi.cc(49,57)的样子:
Nan::New<FunctionTemplate>(FFIPrepCif)->GetFunction());
这就是C:\ Users \ jmk \ AppData \ Local \ node-gyp \ Cache \ 12.18.4 \ include \ node \ v8.h(6126,46)的样子
/** Returns the unique function instance in the current execution context.*/
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
Local<Context> context);
所以看来v8的新版本要求将GetFunction传递给上下文?不确定。我不是JS程序员,也不是C ++程序员。 我想这是否很简单,例如安装一些新的库?
https://github.com/node-ffi/node-ffi/tree/master/src是我目前正在处理的代码。
能给我指出正确的方向吗?
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)