Azure 网站 500 上的 Node.js 状态

标签 node.js azure meanjs

我正在尝试让 Node.js (meanjs) 站点在 Azure 上运行。该网站在我的本地环境中运行没有错误。但是部署后,当我访问我的网站时,我在 Chrome 的网络选项卡中收到 500 错误。对我来说没有明显的错误。

我用了https://groups.google.com/forum/#!topic/meanjs/LrHmE43RSvA引导我了解如何使用 azure cli 进行设置。

它也可以从我的 github 进行部署。

在 Azure 门户中,部署不会失败。我已阅读日志并试图找到问题,但我几乎不知道从哪里开始。例如,通读它,有些事情对我来说看起来很奇怪。 (日志很长,超过了字符限制,否则我会全部发布。)

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. [D:\home\site\repository\node_modules\bson\build\binding.sln]

还有很多

npm WARN unmet dependency

然后它们都得到处理,文件被复制到 wwwroot 并成功完成。

我尝试过的一些事情是更改部署分支、删除网站并重新开始。我有

请告诉我是否还有任何其他内容可以添加到这篇文章中,我真的很想让它发挥作用。

感谢您的帮助。

编辑**

我将 bson 添加到 .gitignore 并收到一个新错误。我还收到了一些新错误,下面是已更改的内容。

[email protected] install D:\home\site\repository\node_modules\bson (node-gyp rebuild 2> builderror.log) || (exit 0)

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.

[D:\home\site\repository\node_modules\bson\build\binding.sln]

npm WARN prefer global [email protected] should be installed with -g npm ERR! Error: ENOENT, chmod >'D:\home\site\repository\node_modules\flatiron\bin\flatiron'

npm ERR! If you need help, you may report this entire log,

我还在目录中添加了 .npmignore,但它是空白的。我尝试将 bson 和 flatiron 添加到 .gitignore 中,但这并没有改变错误。

最佳答案

从您发布的日志中,我可以看到当azure在部署期间尝试安装名为bson的NPM模块时失败,因为您的azure网站所在的虚拟机中没有VC++编译器。

它在你的机器上运行良好,因为你安装了 VC++。

要解决此问题,您最好在您的计算机(x86 或 x64,具体取决于您在 azure 网站中选择的计算机)中编译此模块 (bson),使该模块包含在 .gitignore 中的 node_modules 文件夹,以便在您提交代码时上传它。

我有一篇博客文章提到了这个问题,并且我使用 Node.js SQL Server Driver 作为示例。它还需要VC++编译。 http://blog.shaunxu.me/archive/2012/11/16/install-npm-packages-automatically-for-node.js-on-windows-azure-web.aspx

关于Azure 网站 500 上的 Node.js 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28172924/

相关文章:

javascript - 如何通过 html "JS file"调用 "button-click"并且 JS 文件正在使用 shell.js 运行 bash 脚本

javascript - http 模块(带有 browserify 的 node.js)不使用 PATCH 方法编写请求正文

node.js - 如何在elasticsearch中设置计数器字段

azure - 无法验证域所有权 azure 网站以添加子域

c# - 在 Azure Function 中按顺序处理服务总线消息(无并发调用)

javascript - MEANJS:检查数据库中的 url 并路由到动态 Angular 状态

node.js - 在 Express 4.x 中包含 API 路由

powershell - Azure AD 模块和 MS Online 模块有什么区别

javascript - MEANJS 用户配置文件功能

Node.js 多平台项目结构