我在获取依赖 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/