在 azure 32bit 上安装 nodejs sharp

Install nodejs sharp on azure 32bit

我正在尝试将一个 node.js 项目部署到 Azure Web Apps(免费层),它的依赖项之一是尖锐的:https://github.com/lovell/sharp

在完成部署过程时,我得到:

ERROR: Intel Architecture 32-bit systems require manual installation - please see http://sharp.dimens.io/en/stable/install/
gyp: Call to 'node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (D:\Program Files (x86)\npm.10.3\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit    (internal/child_process.js:204:12)

我已经尝试 运行 在线 Azure 控制台 curl -s https://raw.githubusercontent.com/lovell/sharp/master/preinstall.sh | sudo bash - 中尖锐文档中列出的命令(我在尝试之前删除了 sudo,因为 Azure 不喜欢那样).但是我得到一个错误:

/usr/bin/bash: line 91: type: pkg-config: not found
(23) Failed writing body

因此似乎没有任何效果。不幸的是,我无法将我的环境切换到 x64,因为免费层用户似乎仅限于 32 位环境。我有什么办法可以让它工作吗?

谢谢!

While most modules are simply plain-text JavaScript files, some modules are platform-specific binary images. These modules are compiled at install time, usually by using Python and node-gyp Azure App Service does not support all native modules and might fail at compiling those with very specific prerequisites.

描述来自https://azure.microsoft.com/en-us/documentation/articles/nodejs-use-node-modules-azure-apps/.

您可以在本地环境中安装 windows 32 平台上的 sharp,然后使用包含已编译模块的 node_modules 文件夹将您的应用程序部署到 Azure。

32位Windows环境下安装sharp模块可以参考https://github.com/lovell/sharp/issues/379