Robotjs worked with the previous version of Electron but not the new version.
After install when running the app I get this error.
dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/qashto/Documents/dev/apps/qodemate/node_modules/robotjs/build/Release/robotjs.node
Expected in: flat namespace
dyld: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
Referenced from: /Users/qashto/Documents/dev/apps/qodemate/node_modules/robotjs/build/Release/robotjs.node
Expected in: flat namespace
Trying to use robotjs in my electron based app, Qodemate. Robotjs is the most important module of the app.
yea it would be great if someone can fix this, i need 3.0.0 for its later version of chromium
Can't confirm this, I'm using this with latest electron 3.0.1 for controlling the mouse. But I'm using Windows and Linux, maybe this is platform-specific!
I had robotjs working with electron 3.0 on MacOS 10.13 High Sierra till yesterday. Then I updated to MacOS 10.14 Mojave and it stopped working.
I also just updated to 10.14 Mojave and it does not work with Electron 3.0.2. @octalmage have you tried it on mojave yet?
I've also tried windows 10 + electron 3.0.2 and it didn't work. Rebuilding works:
$ cd ./node_modules/robotjs
$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\Users\\quint\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'E:\\dev\\apps\\qodemate\\node_modules\\robotjs\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\quint\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\quint\\.node-gyp\\10.9.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\quint\\.node-gyp\\10.9.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\quint\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\quint\\.node-gyp\\10.9.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=E:\\dev\\apps\\qodemate\\node_modules\\robotjs',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'E:\\dev\\apps\\qodemate\\node_modules\\robotjs\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
robotjs.cc
win_delay_load_hook.cc
e:\dev\apps\qodemate\node_modules\robotjs\src\os.h(26): warning C4005: 'STRICT': macro redefinition (compiling source file ..\src\robotjs.cc) [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file ..\src\robotjs.cc)
e:\dev\apps\qodemate\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'std::size_t' to 'double', possible loss of data (compiling source file ..\src\robotjs.cc) [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(667): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,std::size_t>(std::A0)' being compiled
with
[
A0=std::size_t
]
deadbeef_rand.c
mouse.c
keypress.c
keycode.c
screen.c
screengrab.c
snprintf.c
MMBitmap.c
..\src\mouse.c(362): warning C4244: '+=': conversion from 'double' to 'std::size_t', possible loss of data [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
..\src\mouse.c(363): warning C4244: '+=': conversion from 'double' to 'std::size_t', possible loss of data [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
..\src\keypress.c(274): warning C4244: 'function': conversion from 'unsigned long' to 'char', possible loss of data [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
..\src\keypress.c(275): warning C4244: 'function': conversion from 'unsigned long' to 'char', possible loss of data [E:\dev\apps\qodemate\node_modules\robotjs\build\robotjs.vcxproj]
Creating library E:\dev\apps\qodemate\node_modules\robotjs\build\Release\robotjs.lib and object E:\dev\apps\qodemate\node_modules\robotjs\build\Release\robotjs.exp
Generating code
All 189 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
Finished generating code
robotjs.vcxproj -> E:\dev\apps\qodemate\node_modules\robotjs\build\Release\\robotjs.node
robotjs.vcxproj -> E:\dev\apps\qodemate\node_modules\robotjs\build\Release\robotjs.pdb (Full PDB)
gyp info ok
But when I try to run I get this error in the electron console:
Uncaught Error: A dynamic link library (DLL) initialization routine failed.
\\?\E:\dev\apps\qodemate\node_modules\robotjs\build\Release\robotjs.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:166:20)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
at Object.<anonymous> (E:\dev\apps\qodemate\node_modules\robotjs\index.js:1)
at Object.<anonymous> (E:\dev\apps\qodemate\node_modules\robotjs\index.js:38
@FibreFoX how'd you get it to work? Do you have windows 10?
Robotjs mouse and keyboard are working in MacOS Mojave. You have to provide accessibility permission for the app to control your Mac. If electron Dev builds are running from vscode, you have to give permission to vscode. Usually an alert pops up asking you to give permission. I missed it the first time due to my multiple monitor seup.
@quinton-ashley as described in the readme of RobotJS, I installed latest Visual Studio (Community Edition) and opted in for Python in version 2 (you might want to make sure NOT to have version 3 selected).
@FibreFoX On windows I did have python 3 selected before which is why the build wouldn't finish, now I am using 2.7 and it builds but throws an error when it runs
@mnakkara On macOS Mojave I'm starting the electron app with terminal and I have accessibility permissions on for Google Chrome, electron, and Terminal. I still get the same error.
@quinton-ashley did you rebuild robotjs after npm install ? I run npm rebuild --runtime=electron --target=3.0.0 --disturl=https://atom.io/download/atom-shell --abi=64
@quinton-ashley I've removed my node_modules folder several times, mostly to avoid conflicts with multiple compilations.
@mnakkara I was rebuilding it with node-gyp on windows like the readme says which wasn't working. That command worked for me on windows! Could this be added to the readme?
@quinton-ashley I got that command from here http://robotjs.io/docs/electron
It has to use the same node that electron uses.
@mnakkara ah I was not aware of that documentation, or rather I must've been aware of it before but I forgot haha, thank you!
i have run
npm rebuild --runtime=electron --target=1.8.6 --disturl=https://atom.io/download/atom-shell --abi=57
got this
npm rebuild --runtime=electron --target=1.8.6 --disturl=https://atom.io/download/atom-shell --abi=57
> [email protected] install C:\Users\senro\Desktop\test\node_modules\robotjs
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=1.8.6 runtime=electron arch=x64 platform=win32)
C:\Users\senro\Desktop\test\node_modules\robotjs>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
โฺดหฝโโโโโโโโาปโโโโโโาปโโโโฤฟโโโโาชโโโรฒโโโโโโษฃโโโโโำกโ/mโโโโโุกโ
robotjs.cc
win_delay_load_hook.cc
c:\users\senro\desktop\test\node_modules\robotjs\src\os.h(26): warning C4005: 'STRICT': macro redefinition (compiling source file ..\src\robotjs.cc) [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\minwindef.h(23): note: see previous definition of 'STRICT' (compiling source file ..\src\robotjs.cc)
c:\users\senro\desktop\test\node_modules\nan\nan_new.h(208): warning C4244: 'argument': conversion from 'size_t' to 'double', possible loss of data (compiling source file ..\src\robotjs.cc) [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
..\src\robotjs.cc(667): note: see reference to function template instantiation 'v8::Local<v8::Number> Nan::New<v8::Number,size_t>(A0)' being compiled
with
[
A0=size_t
]
deadbeef_rand.c
mouse.c
keypress.c
keycode.c
screen.c
screengrab.c
snprintf.c
MMBitmap.c
..\src\mouse.c(362): warning C4244: '+=': conversion from 'double' to 'size_t', possible loss of data [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
..\src\mouse.c(363): warning C4244: '+=': conversion from 'double' to 'size_t', possible loss of data [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
..\src\keypress.c(274): warning C4244: 'function': conversion from 'unsigned long' to 'char', possible loss of data [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
..\src\keypress.c(275): warning C4244: 'function': conversion from 'unsigned long' to 'char', possible loss of data [C:\Users\senro\Desktop\test\node_modules\robotjs\build\robotjs.vcxproj]
Creating library C:\Users\senro\Desktop\test\node_modules\robotjs\build\Release\robotjs.lib and object C:\Users\senro\Desktop\test\node_modules\robotjs\build\Release\robotjs.exp
Generating code
Finished generating code
robotjs.vcxproj -> C:\Users\senro\Desktop\test\node_modules\robotjs\build\Release\\robotjs.node
[email protected] C:\Users\senro\Desktop\test\node_modules\robotjs
[email protected] C:\Users\senro\Desktop\test\node_modules\nan
[email protected] C:\Users\senro\Desktop\test\node_modules\prebuild-install
[email protected] C:\Users\senro\Desktop\test\node_modules\detect-libc
[email protected] C:\Users\senro\Desktop\test\node_modules\expand-template
[email protected] C:\Users\senro\Desktop\test\node_modules\github-from-package
[email protected] C:\Users\senro\Desktop\test\node_modules\minimist
[email protected] C:\Users\senro\Desktop\test\node_modules\mkdirp
[email protected] C:\Users\senro\Desktop\test\node_modules\mkdirp\node_modules\minimist
[email protected] C:\Users\senro\Desktop\test\node_modules\node-abi
[email protected] C:\Users\senro\Desktop\test\node_modules\semver
[email protected] C:\Users\senro\Desktop\test\node_modules\noop-logger
[email protected] C:\Users\senro\Desktop\test\node_modules\npmlog
[email protected] C:\Users\senro\Desktop\test\node_modules\are-we-there-yet
[email protected] C:\Users\senro\Desktop\test\node_modules\delegates
[email protected] C:\Users\senro\Desktop\test\node_modules\readable-stream
[email protected] C:\Users\senro\Desktop\test\node_modules\core-util-is
[email protected] C:\Users\senro\Desktop\test\node_modules\inherits
[email protected] C:\Users\senro\Desktop\test\node_modules\isarray
[email protected] C:\Users\senro\Desktop\test\node_modules\process-nextick-args
[email protected] C:\Users\senro\Desktop\test\node_modules\safe-buffer
[email protected] C:\Users\senro\Desktop\test\node_modules\string_decoder
[email protected] C:\Users\senro\Desktop\test\node_modules\util-deprecate
[email protected] C:\Users\senro\Desktop\test\node_modules\console-control-strings
[email protected] C:\Users\senro\Desktop\test\node_modules\gauge
[email protected] C:\Users\senro\Desktop\test\node_modules\aproba
[email protected] C:\Users\senro\Desktop\test\node_modules\has-unicode
[email protected] C:\Users\senro\Desktop\test\node_modules\object-assign
[email protected] C:\Users\senro\Desktop\test\node_modules\signal-exit
[email protected] C:\Users\senro\Desktop\test\node_modules\string-width
[email protected] C:\Users\senro\Desktop\test\node_modules\code-point-at
[email protected] C:\Users\senro\Desktop\test\node_modules\is-fullwidth-code-point
[email protected] C:\Users\senro\Desktop\test\node_modules\number-is-nan
[email protected] C:\Users\senro\Desktop\test\node_modules\strip-ansi
[email protected] C:\Users\senro\Desktop\test\node_modules\ansi-regex
[email protected] C:\Users\senro\Desktop\test\node_modules\wide-align
[email protected] C:\Users\senro\Desktop\test\node_modules\set-blocking
[email protected] C:\Users\senro\Desktop\test\node_modules\os-homedir
[email protected] C:\Users\senro\Desktop\test\node_modules\pump
[email protected] C:\Users\senro\Desktop\test\node_modules\end-of-stream
[email protected] C:\Users\senro\Desktop\test\node_modules\once
[email protected] C:\Users\senro\Desktop\test\node_modules\wrappy
[email protected] C:\Users\senro\Desktop\test\node_modules\rc
[email protected] C:\Users\senro\Desktop\test\node_modules\deep-extend
[email protected] C:\Users\senro\Desktop\test\node_modules\ini
[email protected] C:\Users\senro\Desktop\test\node_modules\strip-json-comments
[email protected] C:\Users\senro\Desktop\test\node_modules\simple-get
[email protected] C:\Users\senro\Desktop\test\node_modules\decompress-response
[email protected] C:\Users\senro\Desktop\test\node_modules\mimic-response
[email protected] C:\Users\senro\Desktop\test\node_modules\simple-concat
[email protected] C:\Users\senro\Desktop\test\node_modules\tar-fs
[email protected] C:\Users\senro\Desktop\test\node_modules\chownr
[email protected] C:\Users\senro\Desktop\test\node_modules\tar-fs\node_modules\pump
[email protected] C:\Users\senro\Desktop\test\node_modules\tar-stream
[email protected] C:\Users\senro\Desktop\test\node_modules\bl
[email protected] C:\Users\senro\Desktop\test\node_modules\buffer-alloc
[email protected] C:\Users\senro\Desktop\test\node_modules\buffer-alloc-unsafe
[email protected] C:\Users\senro\Desktop\test\node_modules\buffer-fill
[email protected] C:\Users\senro\Desktop\test\node_modules\fs-constants
[email protected] C:\Users\senro\Desktop\test\node_modules\to-buffer
[email protected] C:\Users\senro\Desktop\test\node_modules\xtend
[email protected] C:\Users\senro\Desktop\test\node_modules\tunnel-agent
[email protected] C:\Users\senro\Desktop\test\node_modules\which-pm-runs
but when i run my electron app , got this:
ERROR in ./node_modules/robotjs/build/Release/robotjs.node 1:2
Module parse failed: Unexpected character '๏ฟฝ' (1:2)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/robotjs/index.js 1:14-53
why? can anybody help me? thank you very much!
Don't use electron v1.8.6. Update to the node LTS and the latest version of electron and use this:
npm rebuild --runtime=electron --target=3.0.8 --disturl=https://atom.io/download/atom-shell --abi=64
Most helpful comment
yea it would be great if someone can fix this, i need 3.0.0 for its later version of chromium