node.js - Azure 上的 JSDom( native Node.js 模块)

标签 node.js azure jsdom contextify

我在获取依赖 JSDom 的 Nodejs 应用程序时遇到问题,因为它依赖于 native 模块 - Contextify ,我了解Azure不提供 native 模块的编译。

但是根据 Azure documentation

Since Windows Azure Cloud Services rely on the node_modules folder being deployed as part of the application, any native module included as part of the installed modules should work in a cloud service as long as it was installed and compiled on a Windows development system.

这一切在我的开发盒上运行良好,因为它是在 npm 安装期间编译的,我不明白的是为什么它不能在 Azure 上运行,因为我提供了编译版本?如果它在我的 Windows 开发盒上运行,则编译显然是成功的。我部署到 azure 形成本地 git 存储库,所以我想知道当我提交时编译的文件是否被遗漏?

最佳答案

更新:最新的 Azure 版本(特别是移动服务后端)支持任意 NPM 模块 - See the section on Mobile Services: NPM Module Support

来自 npm 上的 JSDom 文档:

Unfortunately, doing this kind of magic requires C++. And in Node.js, using C++ from JavaScript means using "native modules." Native modules are compiled at installation time so that they work precisely for your machine; that is, you don't download a contextify binary from npm, but instead build one locally after downloading the source from npm.

https://npmjs.org/package/jsdom#contextify

由于您的“ native 模块”与 Azure 的“ native 模块”中的任何计算机没有相同的签名,因此它不会加载。

关于node.js - Azure 上的 JSDom( native Node.js 模块),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15571061/

相关文章:

reactjs - 如何在 Jest 中向我的测试添加 <canvas> 支持?

javascript - 如何在 Javascript/Node.js Azure Function 中使用需要 DOM 和窗口的导入脚本

node.js - 使用sequelize-oracle 没有恢复数据

mysql - Sequelize 原始查询返回 TextRows 数组

azure - 如何将输入参数传递给 Start-NewOrchestration powershell 命令 let

azure - 如何将 AzureKeyVault 中的 secret 用于 PowerShell -Credential?

javascript - 使用 Express 访问 Node.js 中的模型

javascript - nodejs mssql 返回记录集

azure - 通过 Azure DocumentDB 中的 ID 访问资源

reactjs - 我可以在前端使用JSDom来解析html吗