node.js - 安装 ts-java 等 Node 包并不断出现 node-gyp 问题

标签 node.js linux npm node-gyp

我正在使用 Amazon 运行 Ec2,并成功安装了 Node 7。我还确保安装了 node-gyp。我目前正在尝试为 titan-gremlin 功能添加一些其他软件包,每次安装我都会收到相同的错误消息。

/root/.nvm/versions/node/v7.0.0/bin/ts-java -> /root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/bin/ts-java.sh
/root/.nvm/versions/node/v7.0.0/bin/ts-java.js -> /root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/bin/ts-java.js

> java@0.7.2 install /root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/node_modules/java
> node-gyp rebuild

sh: node-gyp: command not found
/root/.nvm/versions/node/v7.0.0/lib
└── (empty)

npm ERR! Linux 4.4.35-33.55.amzn1.x86_64
npm ERR! argv "/root/.nvm/versions/node/v7.0.0/bin/node" "/root/.nvm/versions/node/v7.0.0/bin/npm" "install" "-g" "ts-java"
npm ERR! node v7.0.0
npm ERR! npm  v3.10.8
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn

npm ERR! java@0.7.2 install: `node-gyp rebuild`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the java@0.7.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the java package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs java
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls java
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log
npm ERR! code 1

我已经筋疲力尽了。我已确保所有用户都可以访问 node-gyp。请帮忙。

这是调试日志

    verbose lifecycle java@0.7.2~install: PATH:      /root/.nvm/versions/node/v7.0.0/lib/node_modules/npm/bin/node-gyp-  bin:/root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/node_modules/java/node_modules/.bin:/root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/node_modules/.bin:/root/.nvm/versions/node/v7.0.0/lib/node_modules/.bin:/root/.nvm/versions/node/v7.0.0/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin
11008 verbose lifecycle java@0.7.2~install: CWD: /root/.nvm/versions/node/v7.0.0/lib/node_modules/ts-java/node_modules/java
11009 silly lifecycle java@0.7.2~install: Args: [ '-c', 'node-gyp rebuild' ]
11010 info lifecycle java@0.7.2~install: Failed to exec install script
11011 verbose unlock done using /root/.npm/_locks/staging-bbc034c0b63d0621.lock for /root/.nvm/versions/node/v7.0.0/lib/node_modules/.staging
11012 silly rollbackFailedOptional Starting
11013 silly rollbackFailedOptional Finishing
11014 silly runTopLevelLifecycles Finishing
11015 silly install printInstalled
11016 verbose stack Error: java@0.7.2 install: `node-gyp rebuild`
11016 verbose stack spawn ENOENT
11016 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v7.0.0/lib/node_modules/npm/lib/utils/spawn.js:33:16)
11016 verbose stack     at emitTwo (events.js:106:13)
11016 verbose stack     at ChildProcess.emit (events.js:191:7)
11016 verbose stack     at maybeClose (internal/child_process.js:877:16)
11016 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
11017 verbose pkgid java@0.7.2
11018 verbose cwd /root
11019 error Linux 4.4.35-33.55.amzn1.x86_64
11020 error argv "/root/.nvm/versions/node/v7.0.0/bin/node" "/root/.nvm/versions/node/v7.0.0/bin/npm" "install" "-g" "ts-java"
11021 error node v7.0.0
11022 error npm  v3.10.8
11023 error file sh
11024 error code ELIFECYCLE
11025 error errno ENOENT
11026 error syscall spawn
11027 error java@0.7.2 install: `node-gyp rebuild`
11027 error spawn ENOENT
11028 error Failed at the java@0.7.2 install script 'node-gyp rebuild'.
11028 error Make sure you have the latest version of node.js and npm installed.
11028 error If you do, this is most likely a problem with the java package,
11028 error not with npm itself.
11028 error Tell the author that this fails on your system:
11028 error     node-gyp rebuild
11028 error You can get information on how to open an issue for this project with:
11028 error     npm bugs java
11028 error Or if that isn't available, you can get their info via:
11028 error     npm owner ls java
11028 error There is likely additional logging output above.
           11029 verbose exit [ 1, true ]

最佳答案

我最终需要使用

安装 gyp
sudo yum install gyp

感谢所有花时间看问题的人。

关于node.js - 安装 ts-java 等 Node 包并不断出现 node-gyp 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41252527/

相关文章:

javascript - Jest SecurityError : localStorage is not available for opaque origins

node.js - 如何在从 Node js 应用程序注销后使浏览器缓存失效

node.js - 理解 npm 依赖关系

javascript - create-react-app 中止,代码为 ENOENT

linux - 查找具有大小和时间并按时间戳排序的命令

node.js - npm 如何对不同版本的依赖进行重复数据删除?

javascript - gulp.src() 未读取所需 JSON 文件的数组值

node.js - 如何在 node.js 中捕获箭头键

c++ - 使用 C/C++ 在 Linux 中以编程方式更改 IP 设置

在 Linux 中使用 makefile 编译内核模块