Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

napi.h unable to find in Windows from v3.0.1 #769

Closed
vhashimotoo opened this issue Jul 16, 2020 · 7 comments
Closed

napi.h unable to find in Windows from v3.0.1 #769

vhashimotoo opened this issue Jul 16, 2020 · 7 comments

Comments

@vhashimotoo
Copy link

System: Windows 10 1909
Node.js: v14.5.0

Description

After updating to v3.0.1 that error starts occurred on Windows, the macOS is working as expected. When returning back to 3.0.0 that works as expected and able to find napi.h.

To Reproduce

The repository is default hello world example from node-addon-examples.

git clone https://github.com/HashimotoYT/node-addon-windows-repro
npm install

Logs

PS D:\GitHub\repros> npm install --debug --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   '--debug',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@6.14.5
npm info using node@v14.5.0
npm verb npm-session 568647b4cd2a424a
npm info lifecycle hello_world@0.0.0~preinstall: hello_world@0.0.0
npm timing stage:loadCurrentTree Completed in 20ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 7ms
npm http fetch GET 304 https://registry.npmjs.org/node-addon-api 155ms (from cache)
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 178ms
npm timing stage:loadIdealTree Completed in 190ms
npm timing stage:generateActionsToTake Completed in 2ms
npm verb correctMkdir C:\Users\hashi\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb makeCacheDir UID & GID are irrelevant on win32
npm verb lock using C:\Users\hashi\AppData\Roaming\npm-cache\_locks\staging-76b475affa414abf.lock for D:\GitHub\repros\node_modules\.staging
npm verb unlock done using C:\Users\hashi\AppData\Roaming\npm-cache\_locks\staging-76b475affa414abf.lock for D:\GitHub\repros\node_modules\.staging
npm timing stage:executeActions Completed in 18ms
npm timing stage:rollbackFailedOptional Completed in 1ms
npm info linkStuff hello_world@0.0.0
npm info lifecycle hello_world@0.0.0~install: hello_world@0.0.0

> hello_world@0.0.0 install D:\GitHub\repros
> node-gyp rebuild


D:\GitHub\repros>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild'
gyp verb cli ]
gyp info using node-gyp@5.1.0
gyp info using node@14.5.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\python.exe"
gyp verb find Python - executing "C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\python.exe" to get version
gyp verb find Python - version is "3.8.3"
gyp info find Python using Python version 3.8.3 found at "C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 14.5.0
gyp verb command install [ '14.5.0' ]
gyp verb install input version string "14.5.0"
gyp verb install installing version: 14.5.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 14.5.0
gyp verb build dir attempting to create "build" dir: D:\GitHub\repros\build
gyp verb build dir "build" dir needed to be created? D:\GitHub\repros\build
gyp verb find VS msvs_version not set from command line or npm config
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2019 (16.6.30225.117) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - found Windows SDK: 10.0.18362.0
gyp info find VS using VS2019 (16.6.30225.117) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\GitHub\repros\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\GitHub\repros\config.gypi
gyp verb common.gypi checking for gypi file: D:\GitHub\repros\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\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   'D:\\GitHub\\repros\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\hashi\\AppData\\Local\\node-gyp\\Cache\\14.5.0\\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\\hashi\\AppData\\Local\\node-gyp\\Cache\\14.5.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\hashi\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.5.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\GitHub\\repros',
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   'D:\\GitHub\\repros\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build []
gyp verb build type Debug
gyp verb architecture x64
gyp verb node dev dir C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0
gyp verb found first Solution file build/binding.sln
gyp verb using MSBuild: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Debug;Platform=x64'
gyp info spawn args ]
Выполняется последовательная сборка проектов в этом решении. Чтобы включить параллельную сборку, добавьте параметр "-m".
Сборка начата 16.07.2020 16:18:42.
Проект "D:\GitHub\repros\build\binding.sln" в узле 1 (целевые объекты по умолчанию).
ValidateSolutionConfiguration:
  Создание конфигурации решения "Debug|x64".
Проект "D:\GitHub\repros\build\binding.sln" (1) выполняет сборку "D:\GitHub\repros\build\hello.vcxproj" (2) в узле 1 (целевые объекты по умолчанию).
PrepareForBuild:
  Создание каталога "Debug\obj\hello\".
  Создание каталога "Debug\obj\hello\hello.tlog\".
InitializeBuildStatus:
  Создание "Debug\obj\hello\hello.tlog\unsuccessfulbuild", так как было задано "AlwaysCreate".
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\CL.exe /c /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\include
  \node" /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\src" /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\deps\openssl\config" /I"C:\Users\hashi\AppData\Local\no 
  de-gyp\Cache\14.5.0\deps\openssl\openssl\include" /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\deps\uv\include" /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\ 
  deps\zlib" /I"C:\Users\hashi\AppData\Local\node-gyp\Cache\14.5.0\deps\v8\include" /I"..\node_modulesnode-addon-api" /Z7 /nologo /W3 /WX- /diagnostics:column /MP /Od /Oy- /D NO 
  DE_GYP_MODULE_NAME=hello /D USING_UV_SHARED=1 /D USING_V8_SHARED=1 /D V8_DEPRECATION_WARNINGS=1 /D V8_DEPRECATION_WARNINGS /D V8_IMMINENT_DEPRECATION_WARNINGS /D WIN32 /D _CRT 
  _SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D OPENSSL_NO_PINSHARED /D OPENSSL_THREADS /D NAPI_DISABLE_CPP_EXCEPTIONS /D BUILDING_NODE_EXTENSION /D  
  "HOST_BINARY=\"node.exe\"" /D DEBUG /D _DEBUG /D V8_ENABLE_CHECKS /D _WINDLL /GF /Gm- /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\obj\hello\\" /Fd 
  "Debug\obj\hello\vc142.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:queue ..\hello.cc "C:\Program Files\nodejs\node_modules\npm\node_m 
  odules\node-gyp\src\win_delay_load_hook.cc"
  hello.cc
  win_delay_load_hook.cc
D:\GitHub\repros\hello.cc(1,10): fatal error C1083: Не удается открыть файл включение: napi.h: No such file or directory, [D:\GitHub\repros\build\hello.vcxproj]
Сборка проекта "D:\GitHub\repros\build\hello.vcxproj" завершена (целевые объекты по умолчанию) с ошибкой.

Сборка проекта "D:\GitHub\repros\build\binding.sln" завершена (целевые объекты по умолчанию) с ошибкой.


Ошибка сборки.

"D:\GitHub\repros\build\binding.sln" (целевой объект по умолчанию) (1) ->
"D:\GitHub\repros\build\hello.vcxproj" (целевой объект по умолчанию) (2) ->
(Целевой объект ClCompile) ->
  D:\GitHub\repros\hello.cc(1,10): fatal error C1083: Не удается открыть файл включение: napi.h: No such file or directory, [D:\GitHub\repros\build\hello.vcxproj]

    Предупреждений: 0
    Ошибок: 1

Прошло времени 00:00:01.13
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\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:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 10.0.18363
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:\GitHub\repros
gyp ERR! node -v v14.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm verb lifecycle hello_world@0.0.0~install: unsafe-perm in lifecycle true
npm verb lifecycle hello_world@0.0.0~install: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\GitHub\repros\node_modules\.bin;C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\MySQL\MySQL Server 5.7\bin;C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\Scripts\;C:\Users\hashi\AppData\Local\Programs\Python\Python38-32\;C:\Users\hashi\AppData\Local\Microsoft\WindowsApps;;C:\Users\hashi\AppData\Local\Programs\Microsoft VS Code Insiders\bin;C:\Users\hashi\AppData\Roaming\npm;C:\Users\hashi\AppData\Local\Yarn\bin
npm verb lifecycle hello_world@0.0.0~install: CWD: D:\GitHub\repros
npm timing audit submit Completed in 279ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 279ms
npm timing audit body Completed in 0ms
npm info lifecycle hello_world@0.0.0~install: Failed to exec install script
npm verb stack Error: hello_world@0.0.0 install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
npm verb stack     at EventEmitter.emit (events.js:314:20)
npm verb stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
npm verb stack     at ChildProcess.emit (events.js:314:20)
npm verb stack     at maybeClose (internal/child_process.js:1051:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
npm verb pkgid hello_world@0.0.0
npm verb cwd D:\GitHub\repros
npm verb Windows_NT 10.0.18363
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--debug" "--verbose"
npm verb node v14.5.0
npm verb npm  v6.14.5
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello_world@0.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello_world@0.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm timing npm Completed in 3896ms
@NickNaso
Copy link
Member

Hi @HashimotoYT,
sorry for the inconvenience and thanks to report the problem. We already working to solve it. Please follow the issue #765 and Pull Request #766

@Chris55
Copy link

Chris55 commented Jul 16, 2020

same issue for me, and working fine with v1.7.2 and v2.0.2

`c:\users\chris\source\jtag\git\test-napi\src\test_napi.h(3): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory (compiling source file
..\src\test_napi.cc) [C:\Users\105007811\source\JTag\git\test-napi\build\test-napi-native.vcxproj]

I'm using W10 and Node 12.18.2

`

@seo-rii
Copy link

seo-rii commented Aug 20, 2020

I'm also going through the same issue. When I upgraded dependencies from 3.0.0 to 3.0.1, the build failed with a corresponding message.
I'm using Windows 10 (2004) and Node 12.16.1.

@mhdawson
Copy link
Member

We set the current version back to 3.0.0. Did you choose 3.0.1 on purpose or just the latest. We are currently working on some additional tests and then plan a new release.

@mhdawson
Copy link
Member

@seo-rii

@seo-rii
Copy link

seo-rii commented Aug 28, 2020

Thank you for confirming it!

@NickNaso
Copy link
Member

I'm closing because the v3.0.2 has been released and it should solve the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants