node-gyp rebuild issue for lwip in azure web app: fatal error C1083: Cannot open include file: 'nan.h': No such file or directory

和自甴很熟 提交于 2020-01-15 09:52:10

问题


I have deployed a node application in azure. Environment detail in azure web app is as following-

Python version : 2.7
Platform : 32 bit 
Dotnet framework : 4.6
Node version : 6.3.0
Npm version: 3.10.3

In my application I am using lwip, which need build using visual C++ build tools. When I do npm install its failing on node-gyp rebuild. I am getting many error message for the same message type

"fatal error C1083: Cannot open include file: 'nan.h': No such file or directory"

I have checked that nan module is there in the node_modules.

Complete log is attached here:

D:\home\site\wwwroot>npm install

> lwip@0.0.9 install D:\home\site\wwwroot\node_modules\lwip
> node-gyp rebuild


D:\home\site\wwwroot\node_modules\lwip>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\npm\3.10.3\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  init.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  util.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  buffer_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  jpeg_decoder.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  png_decoder.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  gif_decoder.cpp
d:\home\site\wwwroot\node_modules\lwip\src\decoder\decoder.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_decoder.vcxproj]
  init.cpp
d:\home\site\wwwroot\node_modules\lwip\src\encoder\encoder.h(11): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_encoder.vcxproj]
  jpeg_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\encoder\encoder.h(11): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_encoder.vcxproj]
  png_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\encoder\encoder.h(11): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_encoder.vcxproj]
  gif_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\encoder\encoder.h(11): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_encoder.vcxproj]
  init.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  image.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  resize_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  rotate_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  blur_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  crop_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  mirror_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  pad_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  sharpen_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  hsla_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  opacify_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  paste_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
  setpixel_worker.cpp
d:\home\site\wwwroot\node_modules\lwip\src\image\image.h(13): fatal error C1083: Cannot open include file: 'nan.h': No such file or directory [D:\home\site\wwwroot\node_modules\lwip\build\lwip_image.vcxproj]
gyp ERR! build error 
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\npm\3.10.3\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "D:\\Program Files (x86)\\nodejs\\6.3.0\\node.exe" "C:\\Program Files (x86)\\npm\\3.10.3\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\lwip
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@0.3.8
npm WARN brief@0.0.1 No repository field.
npm WARN brief@0.0.1 No license field.
npm ERR! Windows_NT 6.2.9200
npm ERR! argv "D:\\Program Files (x86)\\nodejs\\6.3.0\\node.exe" "D:\\Program Files (x86)\\npm\\3.10.3\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! lwip@0.0.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the lwip@0.0.9 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lwip package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs lwip
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls lwip
npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log

Thanks


回答1:


Currently, Azure Azure App Service does not support all native modules and might fail at compiling those with very specific prerequisites.

As a workaround, you can run npm install on your local Windows machine that has all the native module's prerequisites installed. Then, deploy the created node_modules folder as part of the application to Azure App Service.

Please refer to https://azure.microsoft.com/en-us/documentation/articles/nodejs-use-node-modules-azure-apps/ for more info.



来源:https://stackoverflow.com/questions/38555257/node-gyp-rebuild-issue-for-lwip-in-azure-web-app-fatal-error-c1083-cannot-open

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!