tobias_r - okay, maybe this is a bit of a stupi...

okay, maybe this is a bit of a stupid issue because it's late, i'm tired, and can't find the right incantations anywhere: how the heck do I get my SK server running again without throwing tons of errors? setup: RP4B running bullseye, untouched for the past few months due to absence from boat and no IP connectivity. upgraded nodejs from 18.x to 22.15 with the "curl https://deb.nodesource.com/setup_22.x | bash" method. noticed a bunch of plugins throwing errors, remembered "oh, i think i have to run npm rebuild after a nodejs upgrade", confirmed by googling. updated npm to latest, then tried rebuild. failed due to some error while compiling $stuff. did the apt upgrade && apt update dance for good measure, then tried npm rebuild again: no joy. it's always the same package that craps out: better-sqlite3@7.6.2 - no idea where that dependency is coming from. deleted (well, tgz'd and then deleted) the node_modules directory in /home/pi/.signalk, tried pulling everything again withnpm install: still no joy. googling the error messages just turned up one thread on the node-gyp github repo where the recommendation was to "remove the dependency, and maybe downgrade to the latest LTS version".. huh? anybody got any hints on what to try next?
22 Replies
Lille Ø
Lille Ø2w ago
You can probably find the problematic dependency in package-lock.json. I'm trying to remember what I did to fix the issue. Maybe got rid of some unmaintained plugin? https://www.npmjs.com/package/signalk-postgsail?activeTab=dependencies We have that one working so have to try to find our what I did In our lockfile that is shown as: better-sqlite3: "^11.10.0", and #postgsail is the only plugin that depends on it here
tobi42
tobi42OP2w ago
there's no package-lock.json file in my .signalk or node_modules directories, just in various subdirectories: pi@tinarasia:~/.signalk $ find . -name package-lock.json ./red/package-lock.json ./node_modules/@abandonware/bluetooth-hci-socket/package-lock.json ./node_modules/@abandonware/noble/package-lock.json ./node_modules/minipass-sized/package-lock.json ./node_modules/signalk-polar/node_modules/baconjs/package-lock.json pi@tinarasia:~/.signalk $
Lille Ø
Lille Ø2w ago
Ah, because there is no successful install
tobi42
tobi42OP2w ago
i just restored the node_modules directory from the backup-tgz
Lille Ø
Lille Ø2w ago
If I look at the bash history on my RPi, I see that after installing Node.js 22, I did a npm i in .signalk followed by editing package.json and another npm i So maybe I got rid of some plugin No, can't find any plugin removals from git history. The likeliest candidate was updating signalk-postgsail from 0.4.0 to 0.5.0
tobi42
tobi42OP2w ago
another thing that is confusing: $ npm -v 10.9.3 $ npm i npm@latest should install 11.6.0, running with --verbose confirms that it gets the tgz from npmjs, yet still: $ npm -v 10.9.3
Lille Ø
Lille Ø2w ago
which npm oh wait, npm i npm@latest -g
tobi42
tobi42OP2w ago
pi@tinarasia:~/.signalk $ which npm /usr/local/bin/npm
Lille Ø
Lille Ø2w ago
it won't be helpful to install NPM under your .signalk 😉
tobi42
tobi42OP2w ago
eh, yeah.. did i mention i'm tired? pi@tinarasia:~/.signalk $ sudo npm i npm@latest -g --verbose npm verbose cli /usr/bin/node /usr/local/bin/npm npm info using npm@10.9.3 npm info using node@v22.15.0 npm verbose title npm i npm@latest npm verbose argv "i" "npm@latest" "--global" "--loglevel" "verbose" npm verbose logfile logs-max:10 dir:/root/.npm/_logs/2025-09-24T18_48_42_035Z- npm verbose logfile /root/.npm/_logs/2025-09-24T18_48_42_035Z-debug-0.log npm http fetch GET 200 https://registry.npmjs.org/npm 541ms (cache revalidated) npm http cache https://registry.npmjs.org/npm 38ms (cache hit) npm http fetch GET 200 https://registry.npmjs.org/npm 325ms (cache revalidated) npm http cache npm@https://registry.npmjs.org/npm/-/npm-11.6.0.tgz 0ms (cache hit) changed 15 packages in 9s 25 packages are looking for funding run npm fund for details npm verbose cwd /home/pi/.signalk npm verbose os Linux 6.1.21-v8+ npm verbose node v22.15.0 npm verbose npm v10.9.3 npm verbose exit 0 npm info ok pi@tinarasia:~/.signalk $ npm -v 10.9.3 still on 10.9.3 what the...?
Lille Ø
Lille Ø2w ago
oh well, it is 10.9.3 also on our SK machine. That shouldn't be the problem
tobi42
tobi42OP2w ago
pi@tinarasia:~ $ which -a npm /usr/local/bin/npm /usr/bin/npm /bin/npm pi@tinarasia:~ $ /usr/local/bin/npm -v 10.9.3 pi@tinarasia:~ $ /usr/bin/npm -v 11.6.0 i don't even...
Lille Ø
Lille Ø2w ago
echo $PATH will likely tell you why
tobi42
tobi42OP2w ago
okay, closing the terminal window and opening another one with a fresh shell fixed that.. oh great.. now npm rebuild doesn't fail with better-sqlite3, it already fails at rebuilding abstract-socket
Lille Ø
Lille Ø2w ago
I don't think I've ever used npm rebuild, just install. I would recommend: check the packages.json, eliminate anything that seems stale or unused, nuke node_modules, run npm i
tobi42
tobi42OP2w ago
okay.. just threw in a npm cache --force clean for good measure, now running npm i --verbose ... let's see what happens aaaand the same better-sqlite3 error again. (and i had already removed signalk-postgsail from /home/pi/.signalk/package.json) threw out another handful of potentially stale plugins that i haven't used in a long time, trying again
Teppo Kurki
Teppo Kurki2w ago
it may be easier to create a copy of .signalk/package.json, purge it and install plugins one by one manually install the ones you need instead of getting rid of ones you may not need...
tobi42
tobi42OP2w ago
just delete everything under "dependencies" in package.json? is that going to mess with the settings for plugins i already had installed, and then install again manually once i have a "clean slate"? @Teppo Kurki installing the plugins from the command line does the same as clicking the "install" button in the admin web gui, right?
Teppo Kurki
Teppo Kurki2w ago
settings are separate, under plugin-config-data. install does not touch them (unless some plugin has a postinstall script for doing something9 yes
Lille Ø
Lille Ø2w ago
Sqlite has been a constant pain with Node.js upgrades. I see that 22+ comes with bundled sqlite, so maybe that pain will go away eventually
tobi42
tobi42OP2w ago
okay, that nuked the entire signalk-server damn okay, the signalk-server is running again, i'm installing plugins one by one.. but something about my canbus interfaces still seems to be "le fuqued", as they say in french ha! i found the plugin that required better-sqlite3@7.6.2, the one that always crapped all over the place! it was... drumroll -> signalk-polar @Lille Ø do you have that plugin installed?
Lille Ø
Lille Ø2w ago
No, that plugin hasn't worked in a while I think

Did you find this page helpful?