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

Windows: fatal error C1083: Cannot open include file: 'napi.h': No such file or directory #2301

Closed
Bob620 opened this issue Jul 20, 2020 · 6 comments

Comments

@Bob620
Copy link

Bob620 commented Jul 20, 2020

Hello,

I have an electron app that I am maintaining and am in the process of updating packages for. While updating Sharp I came across the error fatal error C1083: Cannot open include file: 'napi.h': No such file or directory.

This occurs both on my Mac dev machine as well as on my Windows machine, both envinfo shown below.

I attempted to clear the node-gyp cache, confirm node versions, etc. and was always met with the same error. When attempting to build from source on installation, the same error is thrown so it's clearly not caused by the electron rebuilding process losing something.

I have not worked with node-gyp before so it was quite a time to figure out a solution, I ended up just manually copying the napi.h, napi-inl.h and napi-inl.depercated.h into the node cache folder (appdata/local/node-gpy/cache/*/include/node on windows) located in the build path.

I do not understand what the issue would be nor how to solve it in the future. As it happens on multiple machines I assume it is related to either a change in node-addon-api or a script breaking the environment variables during compilation.

In order to run the majority of tests I simply git cloned this repo and attempted to build from source.

Did you see the documentation relating to installation?

  • Yes

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

  • Yes

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

  • Yes

What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

`npm install --build-from-source --verbose`

>npm install --build-from-source --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:\\Users\\brude\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'install',
npm verb cli   '--build-from-source',
npm verb cli   '--verbose'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 5d9e4b7b57ca730d
npm info lifecycle [email protected]~preinstall: [email protected]
npm timing stage:loadCurrentTree Completed in 1013ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 12ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 573ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 575ms
npm timing stage:loadIdealTree Completed in 1385ms
npm timing stage:generateActionsToTake Completed in 62ms
npm verb correctMkdir C:\Users\brude\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\brude\AppData\Roaming\npm-cache\_locks\staging-0c62f8eb4aa066f5.lock for C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\node_modules\.staging
npm timing action:extract Completed in 40ms
npm timing action:finalize Completed in 3ms
npm timing action:refresh-package-json Completed in 3ms
npm timing action:preinstall Completed in 0ms
npm timing action:build Completed in 1ms
npm timing action:install Completed in 0ms
npm timing action:postinstall Completed in 0ms
npm verb unlock done using C:\Users\brude\AppData\Roaming\npm-cache\_locks\staging-0c62f8eb4aa066f5.lock for C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\node_modules\.staging
npm timing stage:executeActions Completed in 68ms
npm timing stage:rollbackFailedOptional Completed in 3ms
npm info linkStuff [email protected]
npm info lifecycle [email protected]~install: [email protected]

[email protected] install C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp
(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using existing vendored libvips v8.9.1
info sharp Creating C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release
info sharp Copying DLLs from C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\vendor\lib to C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release
prebuild-install info begin Prebuild-install version 5.3.5
prebuild-install info install --build-from-source specified, not attempting download.

C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp>if not defined npm_config_node_gyp (node "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\brude\AppData\Roaming\npm\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:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild'
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | 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:\Python38\python.exe"
gyp verb find Python - executing "C:\Python38\python.exe" to get version
gyp verb find Python - version is "3.8.4"
gyp info find Python using Python version 3.8.4 found at "C:\Python38\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: C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build
gyp verb build dir "build" dir needed to be created? C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build
gyp verb find VS msvs_version was set from command line or npm config
gyp verb find VS - looking for Visual Studio version 2017
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2017 (15.9.28307.586) found at:
gyp verb find VS "D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v141
gyp verb find VS - found Windows SDK: 10.0.17763.0
gyp info find VS using VS2017 (15.9.28307.586) found at:
gyp info find VS "D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
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: C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\config.gypi
gyp verb common.gypi checking for gypi file: C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python38\python.exe
gyp info spawn args [
gyp info spawn args 'C:\Users\brude\AppData\Roaming\npm\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 'C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\brude\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\brude\AppData\Local\node-gyp\Cache\14.5.0',
gyp info spawn args '-Dnode_gyp_dir=C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\brude\\AppData\\Local\\node-gyp\\Cache\\14.5.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp',
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\brude\dev\thermo-reimager-app\node_modules\sharp\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35mcommand?[0m build []
?[0m?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35mbuild type?[0m Release
?[0m?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35marchitecture?[0m x64
?[0m?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35mnode dev dir?[0m C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0
?[0m?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35mfound first Solution file?[0m build/binding.sln
?[0m?[37;40mgyp?[0m ?[0m?[34;40mverb?[0m ?[0m?[35musing MSBuild:?[0m D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn?[0m D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn args?[0m [
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn args?[0m 'build/binding.sln',
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn args?[0m '/nologo',
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn args?[0m '/p:Configuration=Release;Platform=x64'
?[0m?[37;40mgyp?[0m ?[0m?[32minfo?[0m ?[0m?[35mspawn args?[0m ]
?[0mBuilding the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 7/20/2020 3:31:03.
Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
Building solution configuration "Release|x64".
Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" (1) is building "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\libvips-cpp.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
Creating directory "Release\obj\libvips-cpp".
Creating directory "Release\obj\libvips-cpp\libvips-cpp.tlog".
InitializeBuildStatus:
Creating "Release\obj\libvips-cpp\libvips-cpp.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\CL.exe /c /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\include\node" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\src" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\openssl\config" /I"C:\Users\brude\AppData\Local\node-gyp
\Cache\14.5.0\deps\openssl\openssl\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\uv\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\zlib" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\v8\include" /I..\vendor\include /I"..\vendor\include\glib-2.0" /I"..\vendor\lib\glib-2.0\include" /Z7 /nologo /W3 /WX-
/diagnostics:classic /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D "NODE_GYP_MODULE_NAME=libvips-cpp" /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 V
IPS_CPLUSPLUS_EXPORTS /D _ALLOW_KEYWORD_MACROS /D "HOST_BINARY="node.exe"" /D _WINDLL /GF /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\libvips-cpp\" /Fd"Release\obj\libvips-cpp\vc141.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:queue ..\src\libvips\cplusplus\VError.
cpp ..\src\libvips\cplusplus\VConnection.cpp ..\src\libvips\cplusplus\VInterpolate.cpp ..\src\libvips\cplusplus\VImage.cpp "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"
VError.cpp
VConnection.cpp
VInterpolate.cpp
VImage.cpp
win_delay_load_hook.cc
Link:
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\libvips-cpp.dll" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.l
ib uuid.lib odbc32.lib DelayImp.lib "C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\x64\node.lib" ..\vendor\lib\libvips.lib "..\vendor\lib\libglib-2.0.lib" "..\vendor\lib\libgobject-2.0.lib" Delayimp.lib /DELAYLOAD:node.exe /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:\Users\brude\dev\thermo-reima
ger-app\node_modules\sharp\build\Release\libvips-cpp.pdb" /OPT:REF /OPT:ICF /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\libvips-cpp.lib" /MACHINE:X64 /SAFESEH:NO /ignore:4199 /LTCG:INCREMENTAL /DLL "Release\obj\libvips-cpp\VError.obj"
"Release\obj\libvips-cpp\VConnection.obj"
"Release\obj\libvips-cpp\VInterpolate.obj"
"Release\obj\libvips-cpp\VImage.obj"
"Release\obj\libvips-cpp\win_delay_load_hook.obj"
Creating library C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\libvips-cpp.lib and object C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\libvips-cpp.exp
Generating code
All 1061 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
libvips-cpp.vcxproj -> C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\libvips-cpp.dll
FinalizeBuildStatus:
Deleting file "Release\obj\libvips-cpp\libvips-cpp.tlog\unsuccessfulbuild".
Touching "Release\obj\libvips-cpp\libvips-cpp.tlog\libvips-cpp.lastbuildstate".
Done Building Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\libvips-cpp.vcxproj" (default targets).

Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" (1) is building "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\node_modules\node-addon-api\nothing.vcxproj" (3) on node 1 (default targets).
PrepareForBuild:
Creating directory "Release\obj\nothing".
Creating directory "Release\obj\nothing\nothing.tlog".
InitializeBuildStatus:
Creating "Release\obj\nothing\nothing.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\CL.exe /c /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\include\node" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\src" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\openssl\config" /I"C:\Users\brude\AppData\Local\node-gyp
\Cache\14.5.0\deps\openssl\openssl\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\uv\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\zlib" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\v8\include" /Z7 /nologo /W3 /WX- /diagnostics:classic /MP /Ox /Ob2 /Oi /Ot /Oy /D NODE_GYP_MODULE_NAME=nothing /D USIN
G_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 "HOST_BINARY="node.exe"" /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /
GR- /Fo"Release\obj\nothing\" /Fd"Release\obj\nothing\nothing.pdb" /Gd /TC /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:queue "......\node_modules\node-addon-api\nothing.c"
nothing.c
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\CL.exe /c /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\include\node" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\src" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\openssl\config" /I"C:\Users\brude\AppData\Local\node-gyp
\Cache\14.5.0\deps\openssl\openssl\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\uv\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\zlib" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\v8\include" /Z7 /nologo /W3 /WX- /diagnostics:classic /MP /Ox /Ob2 /Oi /Ot /Oy /D NODE_GYP_MODULE_NAME=nothing /D USIN
G_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 "HOST_BINARY="node.exe"" /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /
GR- /Fo"Release\obj\nothing\" /Fd"Release\obj\nothing\nothing.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd4267 /FC /errorReport:queue "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"
win_delay_load_hook.cc
Lib:
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\Lib.exe /OUT:"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\nothing.lib" /NOLOGO /MACHINE:X64 Release\obj\nothing\nothing.obj
Release\obj\nothing\win_delay_load_hook.obj
nothing.vcxproj -> C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\Release\nothing.lib
FinalizeBuildStatus:
Deleting file "Release\obj\nothing\nothing.tlog\unsuccessfulbuild".
Touching "Release\obj\nothing\nothing.tlog\nothing.lastbuildstate".
Done Building Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\node_modules\node-addon-api\nothing.vcxproj" (default targets).

Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" (1) is building "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj.metaproj" (4) on node 1 (default targets).
Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj.metaproj" (4) is building "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj" (5) on node 1 (default targets).
PrepareForBuild:
Creating directory "Release\obj\sharp".
Creating directory "Release\obj\sharp\sharp.tlog".
InitializeBuildStatus:
Creating "Release\obj\sharp\sharp.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\CL.exe /c /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\include\node" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\src" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\openssl\config" /I"C:\Users\brude\AppData\Local\node-gyp
\Cache\14.5.0\deps\openssl\openssl\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\uv\include" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\zlib" /I"C:\Users\brude\AppData\Local\node-gyp\Cache\14.5.0\deps\v8\include" /I"..\node_modulesnode-addon-api" /I..\vendor\include /I"..\vendor\include\glib-2.0" /I"..\vendor\lib\glib
-2.0\include" /Z7 /nologo /W3 /WX- /diagnostics:classic /MP /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=sharp /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_PINSHAR
ED /D OPENSSL_THREADS /D NAPI_VERSION=3 /D _ALLOW_KEYWORD_MACROS /D _FILE_OFFSET_BITS=64 /D BUILDING_NODE_EXTENSION /D "HOST_BINARY="node.exe"" /D _WINDLL /GF /Gm- /EHsc /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\sharp\" /Fd"Release\obj\sharp\vc141.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /wd4275 /wd4244 /wd426
7 /FC /errorReport:queue ..\src\common.cc ..\src\metadata.cc ..\src\stats.cc ..\src\operations.cc ..\src\pipeline.cc ..\src\utilities.cc ..\src\sharp.cc "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc"
common.cc
metadata.cc
stats.cc
operations.cc
pipeline.cc
utilities.cc
sharp.cc
win_delay_load_hook.cc
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\sharp.cc(15): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\metadata.cc(18): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\stats.cc(19): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\utilities.cc(18): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\common.cc(22): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\pipeline.cc(28): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\common.h(22): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory (compiling source file ..\src\operations.cc) [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
Done Building Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj.metaproj" (default targets) -- FAILED.

Done Building Project "C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\binding.sln" (default target) (1) ->
"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj.metaproj" (default target) (4) ->
"C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj" (default target) (5) ->
(ClCompile target) ->
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\sharp.cc(15): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\metadata.cc(18): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\stats.cc(19): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\utilities.cc(18): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\common.cc(22): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\pipeline.cc(28): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]
c:\users\brude\dev\thermo-reimager-app\node_modules\sharp\src\common.h(22): fatal error C1083: Cannot open include file: 'napi.h': No such file or directory (compiling source file ..\src\operations.cc) [C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\build\sharp.vcxproj]

0 Warning(s)
7 Error(s)

Time Elapsed 00:00:03.78
?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mbuild error?[0m
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mstack?[0m Error: D:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe failed with exit code: 1
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mstack?[0m at ChildProcess.onExit (C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mstack?[0m at ChildProcess.emit (events.js:314:20)
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mstack?[0m at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mSystem?[0m Windows_NT 10.0.18363
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mcommand?[0m "C:\Program Files\nodejs\node.exe" "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mcwd?[0m C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mnode -v?[0m v14.5.0
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mnode-gyp -v?[0m v5.1.0
?[0m?[37;40mgyp?[0m ?[0m?[31;40mERR!?[0m ?[0m?[35mnot ok?[0m
?[0mnpm verb lifecycle [email protected]install: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]
install: PATH: C:\Users\brude\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp\node_modules.bin;C:\Users\brude\dev\thermo-reimager-app\node_modules.bin;C:\Users\brude\dev\thermo-reimager-app\node_modules.bin;C:\Python38\Scripts;C:\Python3
8;C:\Program Files (x86)\Python38-32\Scripts;C:\Program Files (x86)\Python38-32;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;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\Git\mingw64\bin;C:\Program Files\Git\usr\bin;D:\Go\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\chocolatey\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Users\brude\AppData\Local\Programs\Python\Python36;C:\Users\brude\AppData\Local\Programs\Python\Python36\Scripts;C:\cuda\bin;E:\php;C:\ffmpeg\bin;C:\Program Files (x86)\ZeroTier\One;C:\Program Files\PuTTY;C:\Program Files\nodejs;C:\Go\bin;C:\Users\brude.cargo\bin;C:\Ruby24-x64\b
in;C:\Users\brude\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;D:\Programs\Fiddler;C:\Users\brude\AppData\Local\Microsoft\WindowsApps;C:\Users\brude\AppData\Roaming\npm;C:\Users\brude\go\bin
npm verb lifecycle [email protected]install: CWD: C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp
npm timing audit submit Completed in 552ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 552ms
npm timing audit body Completed in 0ms
npm info lifecycle [email protected]
install: Failed to exec install script
npm verb stack Error: [email protected] install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm verb stack Exit status 1
npm verb stack at EventEmitter. (C:\Users\brude\AppData\Roaming\npm\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. (C:\Users\brude\AppData\Roaming\npm\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 [email protected]
npm verb cwd C:\Users\brude\dev\thermo-reimager-app\node_modules\sharp
npm verb Windows_NT 10.0.18363
npm verb argv "C:\Program Files\nodejs\node.exe" "C:\Users\brude\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--build-from-source" "--verbose"
npm verb node v14.5.0
npm verb npm v6.14.6
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 9143ms

What is the output of running npx envinfo --binaries --system?

  System:
    OS: Windows 10 10.0.18363
    CPU: (16) x64 AMD Ryzen 7 3800X 8-Core Processor
    Memory: 4.60 GB / 15.93 GB
  Binaries:
    Node: 14.5.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.14.6 - ~\AppData\Roaming\npm\npm.CMD
  System:
    OS: macOS 10.15.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 9.04 GB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.5.0 - /usr/local/bin/node
    npm: 6.14.5 - /usr/local/bin/npm
@Bob620
Copy link
Author

Bob620 commented Jul 20, 2020

I would also like to add that I tried using commit dcc42f8 and modified the install script based off that as a test for electron rebuilding and it was not related to this issue (electron v9.1.0)

@lovell
Copy link
Owner

lovell commented Jul 20, 2020

Hi, you might have run into nodejs/node-addon-api#766 however I wouldn't expect this to fail on macOS.

@lovell
Copy link
Owner

lovell commented Jul 20, 2020

Please can you provide the output of npm install --build-from-source --verbose sharp when run on the macOS machine?

@Bob620
Copy link
Author

Bob620 commented Jul 20, 2020

I was wrong, my mistake. It does not happen on my macOS machine. after running some tests today it seems I was running into a issue with electron and node-canvas compiling that I mistook as an issue with sharp due to my main test environment was windows.

@lovell lovell changed the title fatal error C1083: Cannot open include file: 'napi.h': No such file or directory Windows: fatal error C1083: Cannot open include file: 'napi.h': No such file or directory Jul 21, 2020
@lovell
Copy link
Owner

lovell commented Jul 21, 2020

Thanks for confirming, this is almost certainly due to nodejs/node-addon-api#766 - as soon as it's merged and released as node-addon-api v3.0.2 this problem should go away.

@lovell
Copy link
Owner

lovell commented Aug 25, 2020

sharp v0.26.0 has reverted to node-addon-api v3.0.0 so this should no longer be a problem.

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

No branches or pull requests

2 participants