I find that this module installed by npm i robotjs ,just can't be rebuilt锛孖 have tried electron-rebuild and node-gyp, none of them works.
but today I cloned this repo and using node-gyp rebuild --runtime=electron --target=6.0.5 --disturl=https://atom.io/download/atom-shell --abi=73, it works. I am so happy although dont know why~~
@12Tall can you elaborate the steps you performed and your electron version?
@12Tall can you elaborate the steps you performed and your electron version?
the electron of my prj is 6.0.7 now.
# d:\prj is my workspace, you can change it to your own
# for new project: init it firstly, then npm will generate package.json here
# for existing project: just ignore the following direction 馃憞
D:\prj> npm init
# clone this repo in prj
D:\prj> git clone [email protected]:octalmage/robotjs.git
D:\prj> cd robotjs
D:\prj\robotjs> npm install
# npm install will install electron-1.8.8,
# I think we can also install the last version
# more info: http://robotjs.io/docs/electron
D:\prj\robotjs> node-gyp rebuild --runtime=electron --target=6.0.7 --disturl=https://atom.io/download/atom-shell --abi=73
# also you may meet errors abot "nan varibles not defined", execute npm install nan will solve it
# of course, we should replace '\' by '/' in *nix
D:\prj\robotjs> cd ..\
# install local module in nodejs
D:\prj> npm i -D .\robotjs
# then it will add dependencies in package.json
# "devDependencies": {
# "robotjs": "file:robotjs"
# },
that's all I have done,and I hope it works well in your prj.
Wow, thanks @12Tall
So this lets us use robotjs with newer versions of electronjs?
So this lets us use robotjs with newer versions of electronjs?
I think it does
because it works well in my computer
@12Tall any idea why i'm getting this?
EDIT: On OSX it should be npm i -D ./robotjs (the / vs \ )
@masudhossain
it seems like you have built robotjs successfully,
but there isn鈥檛 package.json in you prj or robotjs directory when you install it as a local module .
Have you executed npm init before clone this repo?
I鈥檓 a newbie for nodejs,
I think it will be easier for me if you can show your demo鈥檚 file structure
:D
I got it working :)
I wasn't in my project directory when i executed that line, and then i realized that you can't use \ in OSX. You have to use /
Thanks for finding a solution to this!
Is this for new projects, or can I implement this on an existing project?
@12Tall
I am referring to cloning the git repo over my project, not npm installing packages. This step :
D:\prj> git clone [email protected]:octalmage/robotjs.git
Is this for new projects, or can I implement this on an existing project?
you can implement this on an existing project.
hahahahaha
I was also having issues compiling this for newer version of electron, I fixed it by updating the nan module and after that it compiled just fine.
There are a easy way to solved.
If u use yarn
yarn add https://github.com/octalmage/robotjs.git\#master,
use npm
npm install https://github.com/octalmage/robotjs.git\#master
Then run:
npm rebuild --runtime=electron --target=6.0.11 --disturl=atom.io/download/atom-shell --abi=73 (I use v6.0.11)
A new version of robotjs supporting the latest NodeJS version will be published soon.
I am trying to use robotjs in my electron on a mips based Ubuntu. Since electron has mips linux version only up to version 1.8.8 (after that, no support), so I download this 1.8.8 electron-mips version. Then, I need to install Node, by checking the node version inside electron 1.8.8, I found it is node8.2.1, so I download this version source code and compile it in my mips platform, seems OK, and node and npm can run successfully. After this, I install libxtst-dev libpng++-dev, and then download the source code from robotjs homepage and unzip it in my directory, and under this directory, "npm install nan".
Then, I try to compile it for my platform with command like:
node-gyp rebuild --runtime=electron --target=1.8.8 --disturl=https://atom.io/download/atom-shell --abi=57
During compiling, it always reports error(robotjs.cc, line 159): no matching function for call to v8::String::Utf8Value bstr(...). And the similar error occurs for line 447 and 486. The robotjs.cc line 159 is:
v8::String::Utf8Value bstr(v8::Isolate::GetCurrent(), Nan::To
Anything wrong with my steps? thanks for your help.
Most helpful comment
the electron of my prj is 6.0.7 now.
that's all I have done,and I hope it works well in your prj.