azure web 应用程序中 lwip 的 node-gyp 重建问题:致命错误 C1083:无法打开包含文件:'nan.h':没有这样的文件或目录

Posted

技术标签:

【中文标题】azure web 应用程序中 lwip 的 node-gyp 重建问题:致命错误 C1083:无法打开包含文件:\'nan.h\':没有这样的文件或目录【英文标题】:node-gyp rebuild issue for lwip in azure web app: fatal error C1083: Cannot open include file: 'nan.h': No such file or directoryazure web 应用程序中 lwip 的 node-gyp 重建问题:致命错误 C1083:无法打开包含文件:'nan.h':没有这样的文件或目录 【发布时间】:2016-11-28 01:23:39 【问题描述】:

我已经在 azure 中部署了一个节点应用程序。 azure web 应用程序中的环境详细信息如下-

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

在我的应用程序中,我使用的是 lwip,它需要使用可视化 C++ 构建工具进行构建。当我做npm install 时,它在node-gyp rebuild 上失败了。我收到许多相同消息类型的错误消息

“致命错误 C1083: 无法打开包含文件: 'nan.h': 没有这样的文件或 目录”

我检查了 node_modules 中有 nan 模块。

完整的日志附在这里:

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

谢谢

【问题讨论】:

【参考方案1】:

目前,Azure Azure App Service 不支持所有本机模块,并且可能无法编译具有非常特定先决条件的模块。

作为一种解决方法,您可以在安装了所有本机模块先决条件的本地 Windows 计算机上运行 npm install。然后,将创建的 node_modules 文件夹作为应用程序的一部分部署到 Azure 应用服务。

更多信息请参考https://azure.microsoft.com/en-us/documentation/articles/nodejs-use-node-modules-azure-apps/。

【讨论】:

我使用本地 git 部署。 node_modules如果没有版本怎么部署(手动复制)? 压缩你的本地node_modules文件夹,复制到Azure,然后解压这个压缩包。 是的,忘记了 FTP。

以上是关于azure web 应用程序中 lwip 的 node-gyp 重建问题:致命错误 C1083:无法打开包含文件:'nan.h':没有这样的文件或目录的主要内容,如果未能解决你的问题,请参考以下文章

STM32 WEB服务器经常用到CGI SSI,可是为啥这方面一个具体的应用教程都没有?

lwip 2.0.2 snmp mib ipv6

有些东西阻止了Azure上Ubuntu localhost的流量

STM32H7 LAN8742 LwIP只有上电后才能正常工作,复位后不行

Azure No 'Access-Control-Allow-Origin' 标头

Azure Devops: COPY failed: stat /var/lib/docker/tmp/docker-builder268095359/xxxxxxx.csproj no such