带有node-gyp的node.js应用程序无法在azure网站上部署

标签 node.js azure node-gyp

我已经建立了一个 Azure 网站,并且正在尝试使用依赖于 node-gyp 的示例应用程序。

我得到这个:

emote: > <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="234d4c47460e465b53425763110d130d13" rel="noreferrer noopener nofollow">[email protected]</a> install C:\DWASFiles\Sites\node-canvas\VirtualDirectory0\site\wwwroot\node_modules\node-salesforce\node_modules\xml2json\node_modules\node-expat
remote: > node-gyp rebuild
remote: 
remote: 
remote: C:\DWASFiles\Sites\node-canvas\VirtualDirectory0\site\wwwroot\node_modules\node-salesforce\node_modules\xml2json\node_modules\node-expat>node "D:\Program Files (x86)\npm\1.2.18\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild 
remote: Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
remote: MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\DWASFiles\Sites\node-canvas\VirtualDirectory0\site\wwwroot\node_modules\node-salesforce\node_modules\xml2json\node_modules\node-expat\build\binding.sln]
remote: gypnpm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0cecfc4c58dc5d8d0c1d4e0928e908e90" rel="noreferrer noopener nofollow">[email protected]</a> install: `node-gyp rebuild`
remote: npm ERR! `cmd "/c" "node-gyp rebuild"` failed with 1
remote: npm ERR! 
remote: An error has occurred during web site deployment.
remote: npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="610f0e05044c041911001521534f514f51" rel="noreferrer noopener nofollow">[email protected]</a> install script.
remote: npm ERR! This is most likely a problem with the node-expat package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR!     node-gyp rebuild
remote: npm ERR! You can get their info via:
remote: npm ERR!     npm owner ls node-expat
remote: npm ERR! There is likely additional logging output above.
remote: 
remote: npm ERR! System Windows_NT 6.2.9200
remote: npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.8.19\\node.exe" "D:\\Program Files (x86)\\npm\\1.2.18\\bin\\npm-cli.js" "install" "--production"
remote: npm ERR! cwd C:\DWASFiles\Sites\node-canvas\VirtualDirectory0\site\wwwroot
remote: npm ERR! node -v v0.8.19
remote: npm ERR! npm -v 1.2.18
remote: npm ERR! code ELIFECYCLE
remote: npm
remote: 
remote: Error - Changes committed to remote repository but deployment to website failed, please check log for further details.
To https://<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bed3d7d5dbfed0d1dadb93dddfd0c8dfcd90cdddd390dfc4cbccdbc9dbdccdd7cadbcd90d0dbca" rel="noreferrer noopener nofollow">[email protected]</a>:443/node-canvas.git
   ef20ef4..147856f  master -> master

人们对此有一个优雅的解决方案吗?还是我需要启动一个 Linux 虚拟机并像这样部署应用程序?

最佳答案

网站的限制。请参阅 http://azure.microsoft.com/en-us/documentation/articles/nodejs-use-node-modules-azure-apps/ 的 native 模块部分.

解决方法/解决方案是在 Windows 开发盒上安装所有模块,并将 node_modules 作为 git 部署的一部分包含在内。

关于带有node-gyp的node.js应用程序无法在azure网站上部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19039842/

相关文章:

node.js - 如何防止 babel 转译生成器函数

json - 将 JSON 数据作为列存储在 Azure 表存储中

electron - 如何打包具有 OCR 功能的 Electron 应用程序?

javascript - 使用 NodeJS 缓冲区

node.js - App.getPath ("userData") 似乎给出了错误的路径

node.js - 如何在 sails.js 中同时执行多个查询

spring-boot - Azure Spring Cloud AppConfiguration刷新不起作用

python - Azure 应用服务上的 Flask 应用程序抛出 "400 Bad Request"错误

node.js - Node gyp 不工作(WindowsError : [Error 183] ═хтючьюцэю ёючфрЄ№ Їрщы,)

javascript - 部署到Heroku node-gyp无法安装base64@2.1.0,node-gyp重建失败