node-ffi-napi / node-ffi-napi

A foreign function interface (FFI) for Node.js, N-API style
MIT License
1.01k stars 147 forks source link

error:node-gyp build error,..\node-addon-api\node_api.gyp not found #227

Open r632420050 opened 2 years ago

r632420050 commented 2 years ago

development environment node: v14.17.0, node-gyp: v9.1.0 vs:2017

When I execute this installation command, I am prompted with an error:

yarn add ffi-napi

error E:\Gsp\code\node_modules\ffi-napi: Command failed.
Exit code: 1
Command: node-gyp-build
Arguments:
Directory: E:\Gsp\code\node_modules\ffi-napi
Output:
E:\Gsp\code\node_modules\ffi-napi>if not defined npm_config_node_gyp (node "D:\java\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "D:\java\nodejs\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@14.18.1 | win32 | ia32
gyp info find Python using Python version 3.9.13 found at "D:\Program Files\Python\python.exe"
gyp info find VS using VS2017 (15.9.28307.2094) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp info spawn D:\Program Files\Python\python.exe
gyp info spawn args [
gyp info spawn args   'D:\\java\\nvm\\v14.18.1\\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   'E:\\Gsp\\code\\\node_modules\\ffi-napi\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\java\\nvm\\v14.18.1\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Administrator\\AppData\\Local\\node-gyp\\Cache\\14.18.1\\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\\Administrator\\AppData\\Local\\node-gyp\\Cache\\14.18.1',
gyp info spawn args   '-Dnode_gyp_dir=D:\\java\\nvm\\v14.18.1\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.18.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=E:\\Gsp\\code\\\node_modules\\ffi-napi',
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   'E:\\Gsp\\code\\\node_modules\\ffi-napi\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp: Active code page: 65001
..\node-addon-api\node_api.gyp not found (cwd: E:\Gsp\code\node_modules\ffi-napi) while loading dependencies of binding.gyp 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:\java\nvm\nvm\v14.18.1\node_modules\node-gyp\lib\configure.js:259:16)        
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Windows_NT 10.0.19044
gyp ERR! command "D:\\java\\nodejs\\node.exe" "D:\\java\\nodejs\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"        
gyp ERR! cwd E:\Gsp\code\node_modules\ffi-napi
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v8.4.1

Did I configure it incorrectly?

ronando82 commented 1 year ago

Same issue here

et-hh commented 1 year ago

Same issue

HexMox commented 1 year ago

npm rebuild succeed sometimes after some local changes according to the existing codes and gyp docs