javascript - npm install robotjs 在构建二进制文件时失败

标签 javascript node.js npm backend

当我运行命令“npm install robotjs -g”时,它给了我这个错误。

robotjs@0.5.1 install C:\Users\Ehsan\AppData\Roaming\npm\node_modules\robotjs prebuild-install || node-gyp rebuild



prebuild-install WARN 安装 未找到预构建的二进制文件
(目标=8.11.3 运行时= Node 架构=x64 平台=win32)

C:\Users\Ehsan\AppData\Roaming\npm\node_modules\robotjs>如果没有定义
npm_config_node_gyp ( Node "C:\Program
文件\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js"
重建)否则( Node “C:\Program
文件\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
重建)C:\程序
文件\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py:891:
警告:'as' 将成为 Python 2.6 Traceback 中的保留关键字
(最近一次通话最后):文件“C:\Program
文件\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py",
第 13 行,在
导入 gyp 文件 "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp__init__.py",
第 8 行,在
导入 gyp.input 文件“C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py”,
第 891 行
除了 ImportError 作为 e:
^ SyntaxError: 无效的语法 gyp ERR!配置错误gyp ERR!堆栈错误:gyp退出代码失败:1
吉普错误! ChildProcess.onCpExit (C:\Program
文件\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:336:16)
吉普错误!堆栈在 emitTwo (events.js:126:13) gyp ERR!堆栈在
ChildProcess.emit (events.js:214:7) 错误错误!堆栈在
Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
吉普错误!系统 Windows_NT 10.0.17133 gyp 错误!命令“C:\程序
文件\nodejs\node.exe""C:\Program
文件\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js"
“重建” gyp ERR! cwd
C:\Users\Ehsan\AppData\Roaming\npm\node_modules\robotjs gyp 错误! Node
-v v8.11.3 gyp 错误! Node -gyp -v v3.6.2 gyp 错误!不好 npm ERR!代码 ELIFECYCLE npm 错误! errno 1 npm 错误!机器人js@0.5.1 安装:
prebuild-install || node-gyp rebuild npm 错误!退出状态 1 npm ERR!
npm 错误!在 robotjs@0.5.1 安装脚本中失败。 npm 错误!这是
npm 可能不是问题。可能有额外的日志记录
上面的输出。

npm 错误!可以在以下位置找到此运行的完整日志:npm ERR!
C:\Users\Ehsan\AppData\Roaming\npm-cache_logs\2018-10-29T09_19_13_980Z-debug.log

最佳答案

我能够在 ubuntu 20.04 中安装(并运行)robotjs:

sudo apt install -y nodejs npm
sudo apt install -y libxtst-dev
sudo apt install -y libpng++-dev
npm install robotjs
收到一些警告,但robotjs 已成功安装:)

关于javascript - npm install robotjs 在构建二进制文件时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53042326/

相关文章:

javascript - 在 Angular 中,我们应该在 .controller.js 中还是在 .html 中调用验证函数?

javascript - Node 调度程序在 Node 服务器崩溃时销毁任务

javascript - 无法在 puppeteer Node js 中启动 chrome

node.js - 无法在 docker 容器中安装 Node 10.x 版本

javascript - 在未知关键帧上平滑地停止 CSS 旋转动画

java - 从 Spring 应用程序运行 PhantomJS 来获取网页缩略图

node.js - 使用 SSL 配置 Nginx 后 Meteor 应用程序无法运行

javascript - Grunt.js 安装问题 - 找不到命令

javascript - 使用 Jest 测试 Typescript,如何测试内部函数?我的导入/导出失败了

node.js - 通过 Node JS 插入时,Mongo shell 不显示集合(命令 show collections)