canboat / canboatjs

Native javascript NMEA 2000 decoder and encoder
Apache License 2.0
98 stars 41 forks source link

Rusoku TouCAN on Raspberry Pi no longer works in Signalk (v 2.11.0) due to error: Cannot find module 'socketcan' #286

Open peterfouche opened 4 days ago

peterfouche commented 4 days ago

My NMEA data all went away after undating SignalK to 2.11.0. If found the eror in the log. Then I installed @canboat/canboatjs and managed to replicate the issue in the console, leading me to conclude the issue is in this project.

Initial problem found in SignalK and replicated on the console by pi@Siobhan-pi:~ $ candumpjs can0

node:internal/modules/cjs/loader:1143 throw err; ^

Error: Cannot find module 'socketcan' Require stack:

sbender9 commented 4 days ago

Something has gone wrong with your install. At install time, it was unable to build the socketcan module.

I would start by reinstalling canboatjs globally and check the install logs to see why it failed.

peterfouche commented 4 days ago

I did get the following when installing, but no other errors.

pi@Siobhan-pi:~ $ sudo npm install -g @canboat/canboatjs npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

added 113 packages in 2m

peterfouche commented 4 days ago

so far it looks like python version issue.

pi@Siobhan-pi:~ $ sudo npm install -g socketcan npm error code 1 npm error path /usr/local/lib/node_modules/socketcan npm error command failed npm error command sh -c node-gyp rebuild npm error gyp info it worked if it ends with ok npm error gyp info using node-gyp@10.2.0 npm error gyp info using node@18.20.4 | linux | arm npm error gyp info find Python using Python version 3.7.3 found at "/usr/bin/python3" npm error gyp info spawn /usr/bin/python3

snip

npm error File "/usr/local/lib/node_modules/socketcan/node_modules/node-gyp/gyp/pylib/gyp/common.py", line 435 npm error if CC := os.environ.get("CC_target") or os.environ.get("CC"): npm error ^ npm error SyntaxError: invalid syntax

Seems a minimun of python 3.8 is needed to get a good compile? Do I have that right?