-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Comments
I would also like to add that I tried using commit dcc42f8 and modified the |
Hi, you might have run into nodejs/node-addon-api#766 however I wouldn't expect this to fail on macOS. |
Please can you provide the output of |
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. |
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. |
sharp v0.26.0 has reverted to node-addon-api v3.0.0 so this should no longer be a problem. |
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
andnapi-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 clone
d this repo and attempted to build from source.Did you see the documentation relating to installation?
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 bynpm view sharp dist-tags.latest
?If you are using the
ignore-scripts
feature ofnpm
, have you tried with thenpm install --ignore-scripts=false
flag?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`
What is the output of running
npx envinfo --binaries --system
?The text was updated successfully, but these errors were encountered: