Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot install robotjs #754

Open
gokul-3 opened this issue Feb 13, 2024 · 7 comments
Open

I cannot install robotjs #754

gokul-3 opened this issue Feb 13, 2024 · 7 comments

Comments

@gokul-3
Copy link

gokul-3 commented Feb 13, 2024

When I try to install robotjs, it ends with error

npm ERR! code 1
npm ERR! path /home/gokulakannan/robot/node_modules/robotjs
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory '/home/gokulakannan/robot/node_modules/robotjs/build'
npm ERR! CXX(target) Release/obj.target/robotjs/src/robotjs.o
npm ERR! make: Leaving directory '/home/gokulakannan/robot/node_modules/robotjs/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/gokulakannan/robot/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/gokulakannan/robot/node_modules/robotjs/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/gokulakannan/robot/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/gokulakannan/.cache/node-gyp/20.7.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/gokulakannan/.cache/node-gyp/20.7.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/gokulakannan/robot/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/gokulakannan/.cache/node-gyp/20.7.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/gokulakannan/robot/node_modules/robotjs',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! cc1plus: warning: command-line option ‘-Wbad-function-cast’ is valid for C/ObjC but not for C++
npm ERR! In file included from ../src/keypress.h:6,
npm ERR! from ../src/robotjs.cc:7:
npm ERR! ../src/keycode.h:112:10: fatal error: X11/Xutil.h: No such file or directory
npm ERR! 112 | #include <X11/Xutil.h>
npm ERR! | ^~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [robotjs.target.mk:135: Release/obj.target/robotjs/src/robotjs.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: make failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess. (/home/gokulakannan/robot/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 6.1.0-1029-oem
npm ERR! gyp ERR! command "/usr/local/lib/node_modules/node/bin/node" "/home/gokulakannan/robot/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/gokulakannan/robot/node_modules/robotjs
npm ERR! gyp ERR! node -v v20.7.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

what #include <X11/Xutil.h> means? Is there any dependency for this package

@orange250
Copy link

window OS?need build 需要编译 node-gyp 工具

  1. 安装 python3.11
    2.安装visual studio 2022 支持桌面C++的选项√上
  2. cd到 robot目录 node-gyp rebuild .
    多看看 http://robotjs.io/docs/building

@estoylive
Copy link

wtf dude? speak English please

@s1hofmann
Copy link

@gokul-3 what #include <X11/Xutil.h> means? Is there any dependency for this package that's a C header for X11, which is required to build robotjs on your Linux machine. You'll have to install it using whichever package management your distribution uses.

As an alternative, nut.js is fully prebuilt for macOS, Windows and Linux and provides an actively maintained alternative to robotjs

@DanielMcAssey
Copy link

DanielMcAssey commented Mar 27, 2024

We also maintain a working fork of RobotJS, which is actively maintained as we use it in several of our projects. https://github.com/hurdlegroup/robotjs

It includes many of the fixes and uses NAPI, and includes prebuilt binaries for all available platforms

@orange250
Copy link

orange250 commented Mar 27, 2024 via email

@ftyszyx
Copy link

ftyszyx commented Sep 19, 2024

Robotjs (https://github.com/octalmage/robotjs)is build use V8 API.So it must be rebuilt for different Node versions.
This is a big trouble when installing on a platform that has no build environment..
So I rewrapped Robotjs with Node API and prebuilt it. Now you can install robotjs_addon with just one command
npm install robotjs_addon
And it is compatible with different Node versions. It's open source. You can check it out if you are interested.https://github.com/ftyszyx/robotjs
Warm: some api is removed,because there is no need for me, you can help to improve.

@orange250
Copy link

orange250 commented Sep 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants