我有一个使用express的基本 Node Web应用程序,它依赖于node-sass库。
这是在 Win64 服务器上构建的,因此在构建的 npm install 部分期间,由于当前环境,它会下载绑定(bind)二进制文件的 x64 版本。
当部署到 Azure 应用服务时,由于与 Node-sass 绑定(bind)二进制文件不兼容,它会引发运行时错误,因为 Node 在 Azure 应用服务中运行 32 位...
Error: Missing binding D:\home\site\wwwroot\node_modules\node-sass\vendor\win32-ia32-48\binding.node Node Sass could not find a binding for your current environment: Windows 32-bit with Node.js 6.x
Found bindings for the following environments: - Windows 64-bit with Node.js 6.x
当我明确 checkin the 32bit binding时并重新部署我有时会收到 502 网关错误...
502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
有时我只是得到 500,但它不再将错误写入日志。
该应用程序明确依赖于node-sass-middleware包版本0.11,它依赖于node-sass 4.3.0。
如果没有任何错误日志,我就陷入了死胡同。您以前遇到过这个问题吗?如果有,您是如何解决的?
最佳答案
我利用了Node-Sass Example App进行快速测试,使用 local git将其示例项目部署到 Azure Web Apps,这重现了您的问题。
通过部署日志:
remote: Selected node.js version 7.4.0. Use package.json file to choose a different version. remote: Selected npm version 4.0.5
并根据类似的错误消息:
Found bindings for the following environments: - Windows 64-bit with Node.js 6.x
我在package.json
中指定了node.js版本:
"engines": {
"node": "= 6.9.1",
"npm": "> 3"
}
然后通过本地git将其重新部署到Azure,示例工作正常。
对于进一步的 500 错误,您可以尝试利用应用服务编辑器来检查网站的输出。
关于node.js - Azure 应用服务上使用 Node-sass 的 Express 应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41874420/