问题描述
首先感谢您的帮助。
我有一个 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 [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] 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 [email protected] 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 文件,如下所示:
2.- 我从 package.json 中删除了 SHARP 依赖项——这使得 cpanel 中的 NPM INSTALL 过程顺利,没有错误,但在我的项目中确实需要sharp,因此删除它不是生产的可行选项.
我检查过的链接: StackOverflow question.
有人遇到过这个吗? 非常感谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)