微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 Node Js API REST 部署到 CPANEL 时如何修复二进制错误 共享主机

如何解决将 Node Js API REST 部署到 CPANEL 时如何修复二进制错误 共享主机

首先感谢您的帮助。

我有一个 Node js API REST,我使用 Express、fs 模块、图像锐化和许多其他,在我的机器上一切正常,我想在几个月前购买的共享主机中测试这个 API。

我的文件夹中有我的应用程序,节点 js 从 CPANEL 创建应用程序识别我的 JSON 文件,当我单击 NPM INSTALL 时,这是出现的错误

npm WARN lifecycle The node binary used for scripts is /home/webfoqgo/nodevenv/server/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
ERR! sharp Use with glibc 2.12 requires manual installation of libvips >= 8.10.0
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
make: execvp: cc: Permission denied
make: *** [Release/obj.target/nothing/../node-addon-api/nothing.o] Error 127
gyp ERR! build error 
gyp ERR! stack Error: `make` Failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/alt/alt-nodejs12/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 2.6.32-954.3.5.lve1.4.77.el6.x86_64
gyp ERR! command "/opt/alt/alt-nodejs12/root/usr/bin/node" "/opt/alt/alt-nodejs12/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/webfoqgo/nodevenv/server/12/lib/node_modules/sharp
gyp ERR! node -v v12.19.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN building-backend@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.26.3 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sharp@0.26.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/webfoqgo/.npm/_logs/2021-01-27T20_32_15_794Z-debug.log

我尝试了两件事:

1.- 我在我的项目根目录中创建了一个 .npmrc 文件,如下所示:

Please let me know if i am doing this incorrectly

2.- 我从 package.json 中删除了 SHARP 依赖项——这使得 cpanel 中的 NPM INSTALL 过程顺利,没有错误,但在我的项目中确实需要sharp,因此删除它不是生产的可行选项.

我检查过的链接StackOverflow question.

有人遇到过这个吗? 非常感谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。