【问题标题】:Node_modules installation fails on Debian 9Debian 9 上的 Node_modules 安装失败
【发布时间】:2020-05-16 09:43:00
【问题描述】:

我已经在 GCP Compute Engine 上部署了我的 KeystoneJS 项目,但是当我运行 npm_install 时,我发现了一个错误。有什么办法可以解决吗?

我做了什么:

  • 创建了一个使用 Debian 9 的 VM 实例。
  • 将所有文件克隆到新文件夹中的存储库
  • 为我的网站创建了一个外部 IP 地址

KeystoneJS 使用Node.jsMongoDB,我都安装了。

nodejs --version
v12.14.1
npm --version
6.13.4

然后我尝试安装node_modules,但安装失败。

> kerberos@0.0.22 install /home/retvizanjr/seebelarus.by/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)

make: Entering directory '/home/retvizanjr/seebelarus.by/node_modules/kerberos/build'
  CXX(target) Release/obj.target/kerberos/lib/kerberos.o
In file included from ../lib/kerberos.cc:1:0:
../lib/kerberos.h:5:27: fatal error: gssapi/gssapi.h: No such file or directory
 #include <gssapi/gssapi.h>
                           ^
compilation terminated.
kerberos.target.mk:113: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1
make: Leaving directory '/home/retvizanjr/seebelarus.by/node_modules/kerberos/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.9.0-11-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/retvizanjr/seebelarus.by/node_modules/kerberos
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/retvizanjr/seebelarus.by/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.9.0-11-amd64
gyp ERR! command "/usr/bin/node" "/home/retvizanjr/seebelarus.by/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/retvizanjr/seebelarus.by/node_modules/node-sass
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.5.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.5.0 postinstall 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/retvizanjr/.npm/_logs/2020-01-30T17_22_51_506Z-debug.log

我在安装 Kerberos 软件包后收到此错误,而不是第一个错误

kerberos.target.mk:113: recipe for target 'Release/obj.target/kerberos/lib/kerberos.o' failed
make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1
make: Leaving directory '/home/retvizanjr/seebelarus.by/node_modules/kerberos/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:223:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.9.0-11-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/retvizanjr/seebelarus.by/node_modules/kerberos
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 

【问题讨论】:

    标签: node.js linux npm google-cloud-platform google-compute-engine


    【解决方案1】:

    尝试安装 Kerberos 开发包:

    $ sudo apt-get update
    $ sudo apt-get install libkrb5-dev
    

    【讨论】:

    • 我必须在npm install之后还是之前做?
    • 您应该在尝试安装node_modules之前运行这些命令。
    • 我已经安装了它,但是当我运行npm install 时,我得到了同样的错误。
    • 你还有fatal error: gssapi/gssapi.h: No such file or directory 第一个截图吗?
    • 我已经更新了问题并添加了新错误的代码。
    猜你喜欢
    • 2013-05-09
    • 2018-06-03
    • 2021-10-14
    • 2022-12-23
    • 2018-01-01
    • 2014-12-16
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    相关资源
    最近更新 更多