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

HELP! cncjs-pendant-gamepad.js: No such file or directory #13

Open
jamhot1 opened this issue Jul 7, 2024 · 7 comments
Open

HELP! cncjs-pendant-gamepad.js: No such file or directory #13

jamhot1 opened this issue Jul 7, 2024 · 7 comments

Comments

@jamhot1
Copy link

jamhot1 commented Jul 7, 2024

would really appreciate some help getting this setup. loaded CNCJS onto a RPI lite os version. have managed to setup SIXAD bluetooth but for some reason, after I install the gamepad and run I get no file or directory found errors, see below. I have limited experience with linux and have tried different versions of node (16 currently) still no ball. I will add that the install appears to go without errors apart from some vulnerabilities. I must be missing something crucial to get this going. I just don't have enough knowledge of linux to figure this out.

bin/cncjs-pendant-gamepad.js -p /dev/ttyUSB0 -b 115200 -t grbl --so cket-port 80
-bash: bin/cncjs-pendant-gamepad.js: No such file or directory
pi@cncjs:~ $ cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js -p /dev/ttyUSB0 -b 115200 -t grbl --socket-port 80
WARN CLI Error: ENOENT: no such file or directory, open '/etc/cncjs-pendan t-gamepad.rc.json'
WARN CLI at Object.openSync (node:fs:590:3)
WARN CLI at Object.readFileSync (node:fs:458:35)
WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28)
WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:75:26)
WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46)
WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1
WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 )
WARN CLI at async Promise.all (index 0)
WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24)
WARN CLI at async loadESM (node:internal/process/esm_loader:91:5)
WARN CLI Error: ENOENT: no such file or directory, open '/etc/cncjs-penda nt-gamepad.rc.json'
WARN CLI at Object.openSync (node:fs:590:3)
WARN CLI at Object.readFileSync (node:fs:458:35)
WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28)
WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:75:26)
WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46)
WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1
WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 )
WARN CLI at async Promise.all (index 0)
WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24)
WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) {
WARN CLI errno: -2,
WARN CLI syscall: 'open',
WARN CLI code: 'ENOENT',
WARN CLI path: '/etc/cncjs-pendant-gamepad.rc.json'
WARN CLI }
WARN CLI Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-p endant-gamepad.rc.json'
WARN CLI at Object.openSync (node:fs:590:3)
WARN CLI at Object.readFileSync (node:fs:458:35)
WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28)
WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:76:26)
WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46)
WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1
WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 )
WARN CLI at async Promise.all (index 0)
WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24)
WARN CLI at async loadESM (node:internal/process/esm_loader:91:5)
WARN CLI Error: ENOENT: no such file or directory, open '/home/pi/.cncjs- pendant-gamepad.rc.json'
WARN CLI at Object.openSync (node:fs:590:3)
WARN CLI at Object.readFileSync (node:fs:458:35)
WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28)
WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:76:26)
WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46)
WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1
WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 )
WARN CLI at async Promise.all (index 0)
WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24)
WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) {
WARN CLI errno: -2,
WARN CLI syscall: 'open',
WARN CLI code: 'ENOENT',
WARN CLI path: '/home/pi/.cncjs-pendant-gamepad.rc.json'
WARN CLI }
cncjs-pendant-gamepad is currently running. Stop running with Control-C
Use 'cncjs-pendant-gamepad --help' if you're expecting to see something else her e.
file:///home/pi/cncjs-pendant-gamepad/lib/connector.js:117
this.socket.on(msg, callback);
^

TypeError: Cannot read properties of undefined (reading 'on')
at Connector.subscribeMessage (file:///home/pi/cncjs-pendant-gamepad/lib/con nector.js:117:25)
at new GcodeGrbl (file:///home/pi/cncjs-pendant-gamepad/lib/gcode-grbl.js:7: 24)
at Actions.newGcodeSender (file:///home/pi/cncjs-pendant-gamepad/lib/actions .js:51:16)
at new Actions (file:///home/pi/cncjs-pendant-gamepad/lib/actions.js:34:33)
at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/console.js:32:5)
at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js:12:1
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async loadESM (node:internal/process/esm_loader:91:5)

@grukx
Copy link

grukx commented Nov 12, 2024

I have the same problems. The first messages you get are just missing json config files, I just copied the one in the src-folder and these went away.

The real error is here:
cncjs-pendant-gamepad/lib/connector.js:117 this.socket.on(msg, callback); ^ TypeError: Cannot read properties of undefined (reading 'on')

With only a brief look into the code it looks cncjs connection related. It fails here
//--------------------------------------------------------------------------
// Handle receiving messages from cncjs socket server, or faking
// out for --fake-socket option.
//--------------------------------------------------------------------------
subscribeMessage(msg: string, callback: any) {
if (!this.options.simulate)
this.socket.on(msg, callback);
log.info(this.logPrefix, Ready to listen for message '${msg}' from the socket.);
};

Running with "simulate" command does not crash it.

Geir

@jamhot1
Copy link
Author

jamhot1 commented Nov 14, 2024

Ah, Not just me then. I was really keen to get this going but had to give up after nearly a week of my evenings and a weekend was sunk going around in circles with this. Please do post if you find a working system.

@grukx
Copy link

grukx commented Nov 14, 2024 via email

@jamhot1
Copy link
Author

jamhot1 commented Nov 14, 2024

Oh. I thought you still had problems when reading your last post. So you copied the configs in the src-folder and that allowed it to function? What is the problem with the connector you stated?

@grukx
Copy link

grukx commented Nov 14, 2024

The code is not very forgiving when it comes to connecting to the gamepad. I use a wireless gamepad and I get this error when the gamepad is not connected. It starts ok when my gamepad is up and running, but crashes when I disconnect. I have a patch for this, but it conflicts with another pull request that attempts to fix related issues with the communication retries.

If you get the this.socket.on(msg, callback); error it is likely an issue with the gamepad not being connected and detected as it should.

@grukx
Copy link

grukx commented Nov 14, 2024

Pushed some code to make this more robust. I run ok with both PR9 and my fixes. For testing you can pull them from the "dev" branch in https://github.com/grukx/cncjs-pendant-gamepad.git if you dont want to merge stuff yourself.

@grukx
Copy link

grukx commented Nov 14, 2024

btw the description for getting this to work is pretty inaccurate - on my install with the latest cncjs I had to do this to get things working as it should. Note the use of a fixed IP and no serial information given for the cncjs-pendant

pm2 start $(which cncjs) -- --host 192.168.102.70 --port 8000 -w /home/ge/watch --allow-remote-access --controller Grbl
pm2 start /home/ge/cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js -- -t Grbl --socket-port 8000 --socket-address 192.168.102.70 -vv run

Turns out that if you give the serial port to the pendant it will try to open it itself instead of going through cncjs. If you give --host 0.0.0.0 to cncjs it ends up binding to 127.0.0.1 for some reason, but works if you bind to the specific adapter address.

...and I recommend going through the commands that the pendant issues carefully before any hardware test, fun stuff can happen if this is not matched to your machine...

Geir

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

2 participants