samyk / easel-driver

Easel driver for Linux, Mac, Windows, ARM, Raspberry Pi, Intel, FTDI, CH340, CH341, CP210x, FTDI clones, local, and remote access to GRBL-based CNC controllers
95 stars 24 forks source link

Node run failure and not running on reboot #14

Closed Albertus02 closed 3 years ago

Albertus02 commented 3 years ago

Hello, Using the the command curl https://raw.githubusercontent.com/samyk/easel-driver/master/easel-driver.sh | sh -x, Installation succeeds and I can see the driver running in screen by doing screen -r easel. However, the Xcarve machine doesn't seem to be picked up (even with the driver running). After rebooting I'm not sure the driver is running even thought is added crontab:

$ crontab -l
@reboot . ~/.bashrc ; cd ~/easel-driver && /usr/bin/screen -L -dmS easel node iris.js

And if I try to run node manually seems that I have a version issue on the bindings module:

~/easel-driver $ node iris.js 
/home/pi/easel-driver/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: The module '/home/pi/easel-driver/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 88. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at bindings (/home/pi/easel-driver/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/easel-driver/node_modules/@serialport/bindings/lib/linux.js:1:36)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32) {
  code: 'ERR_DLOPEN_FAILED'
}

Still not quite sure why Easel doesn't find any machine and how this node run when I install it from bash but not after rebooting but I'll much appreciate any ideas on this.

Thanks.

samyk commented 3 years ago

Did you already have node installed? I think you may have multiple node versions. What if you run ~/.bashrc && node iris.js

Albertus02 commented 3 years ago

Hello, sorry for the delay, I've been trying to get some success before writing back but seems that I can't. Running what you suggested I get the same error:

pi@xcarvepi:~/easel-driver $ . ~/.bashrc && node iris.js
/home/pi/easel-driver/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: The module '/home/pi/easel-driver/node_modules/@serialport/bindings/build/Release/bindings.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 88. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1167:18)
    at Module.load (node:internal/modules/cjs/loader:973:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Module.require (node:internal/modules/cjs/loader:997:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at bindings (/home/pi/easel-driver/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/home/pi/easel-driver/node_modules/@serialport/bindings/lib/linux.js:1:36)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:973:32) {
  code: 'ERR_DLOPEN_FAILED'
}

I've have node version v15.4.0 and I think this script is installing v12.19.0 if I'm not mistaken?

pi@xcarvepi:~/easel-driver $ ls -l /home/pi/.nvm/versions/node/                
drwxr-xr-x 6 pi pi 4096 Dec 17 22:52 v12.19.0
drwxr-xr-x 6 pi pi 4096 Dec 15 23:07 v15.4.0

I've tried to change the script and use v15 (the one I had installed but it fails on bindings

+ npm install
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated mkdirp@0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! code 1
npm ERR! path /home/pi/easel-driver/node_modules/@serialport/bindings
npm ERR! command failed
npm ERR! command sh -c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! make: Entering directory '/home/pi/easel-driver/node_modules/@serialport/bindings/build'
npm ERR!   CXX(target) Release/obj.target/bindings/src/serialport.o
npm ERR! make: Leaving directory '/home/pi/easel-driver/node_modules/@serialport/bindings/build'

I'll keep trying to use the version of Node that I have installed but if you have any other ideas of what I could try, please let me know. Thanks for the help

samyk commented 3 years ago

I explicitly have it set to v12 because a newer version of node wasn't compatible with one of the modules last I tested. Is this a machine you'd allow me to ssh into? I can provide a reverse tunnel and investigate -- you can reach me at code@samy.pl

Albertus02 commented 3 years ago

Hello, Good news is that works fine with node v12 and I set that as default instead of the v15. Drivers seems to work as expected on '''screen''' when running manually. However, I'm struggling now with crontab not executing the screen command on reboot.

Albertus02 commented 3 years ago

Seems that crontab needed the full path of the node command in order to run... took me a while to figure it out. Thanks for all the help