All SK Plugins installs fail

more info here: https://forum.openmarine.net/showthread.php?tid=6355&pid=34507#pid34507 But basically SK is running along side Maretron Connect on a 4B Pi. Node is non standard install by default and I can't change that. I am getting this from the SK Log - stderr: Error: spawn npm ENOENT. $PATH = /home/[user name]/.config/nvm/versions/node/v22.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games Which includes the path to NPM/Node. Any Ideas? I've tried symoblic link, but mayebe not set correctly? I added none_modules to /usr/local pointing otthe above path.
46 Replies
Scott Bender
Scott Bender3mo ago
the problem is that npm is not in the path just make sure npm is in the PATH of the user that runs the server
Teppo Kurki
Teppo Kurki3mo ago
The error message probably means that starting npm is failing because it can not be found Ah what scott said [user name] seems really suspicious in the first path entry. Most probably you don’t have a user named [user name]
Scott Bender
Scott Bender3mo ago
missed that nvm config is messed up I think
Skybolt
SkyboltOP3mo ago
How should NVM be configured? The above [user name] should be "maretron", sorry. The very first part of the path points to npm and node. Confussed now.
Teppo Kurki
Teppo Kurki3mo ago
what very first part of the path? i think that is the problem - instead of /home/[user name]/.config/nvm/versions/node/v22.17.0/bin it should probably be /home/maretron/.config/nvm/versions/node/v22.17.0/bin if you just start a shell can you run npm? If yes what does which npm say?
Skybolt
SkyboltOP3mo ago
Sorry, the path is what you say it should be. The [user name] was what I put in for the post. This is ht elast line of launching a terminal and typing npm. npm@10.9.2 /home/maretron/.config/nvm/versions/node/v22.17.0/lib/node_modules/npm typing echo $PATH produces - /home/maretron/.config/nvm/versions/node/v22.17.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
Teppo Kurki
Teppo Kurki3mo ago
since you edited your opening comment I assume that you just added the $PATH... part at the end and that is not part of the error message? because it sounds like even if your shell has PATH set up correctly the signalk-server node process seems to be unable to find npm can you check what user the node process running signalk server is running under? and with the process's id (pid) you can check what the valjue the PATH environment variable has with sudo cat /proc/<pid>/environ
Skybolt
SkyboltOP3mo ago
no pid displayed. Yes $PATH was after the original post. It's very hard to format post's here, sorry.
No description
Skybolt
SkyboltOP3mo ago
@Teppo Kurki and @Scott Bender Thank you for your help.
Teppo Kurki
Teppo Kurki3mo ago
495, the first number on the line is the pid no worries about formatting - and as you see it is easy to misunderstand
Skybolt
SkyboltOP3mo ago
There is nothing listed for those PID's, 485 or 495
Skybolt
SkyboltOP3mo ago
No description
Teppo Kurki
Teppo Kurki3mo ago
does the process still have the same pid or has it restarted and gotten a new pid?
Skybolt
SkyboltOP3mo ago
Sorry, it changed. Didn't know it would do that for no reason.
No description
Scott Bender
Scott Bender3mo ago
So that shows that nvm is not in the PATH Something to do with the way your starting the server, or the way the NVM environment is setup for that user. (BYW, I use nvm also, without issue)
Skybolt
SkyboltOP3mo ago
This is how SK is being started: [Service] ExecStart=/home/maretron/.signalk/signalk-server Restart=always StandardOutput=syslog StandardError=syslog WorkingDirectory=/home/maretron/.signalk User=maretron Environment=EXTERNALPORT=3000 Environment=NODE_ENV=production Environment=RUN_FROM_SYSTEMD=true [Install] WantedBy=multi-user.target Ok, got it to work by adding a symbolic link to the /usr/bin dir for npm. Thank you both for helping solve this!!!
Scott Bender
Scott Bender3mo ago
Well, not thr right fix... can you show the contents of /home/maretron/.signalk/signalk-server
Skybolt
SkyboltOP3mo ago
That isn't where it is install. only /home/maretron/.signalk is there.
Scott Bender
Scott Bender3mo ago
that's your startup script ExecStart=/home/maretron/.signalk/signalk-server
Skybolt
SkyboltOP3mo ago
Signalk-Server seems to be installed in: /home/maretron/.config/nvm/versions/node/v22.17.0/bin/signalk-server
Scott Bender
Scott Bender3mo ago
I want to see the startup script
Skybolt
SkyboltOP3mo ago
This is the contents of that script: #!/bin/sh /home/maretron/.config/nvm/versions/node/v22.17.0/lib/node_modules/signalk-server/bin/signalk-server -c /home/maretron/.signalk $*
Scott Bender
Scott Bender3mo ago
ok, that looks good
Skybolt
SkyboltOP3mo ago
Under the server update it states: It can't be updated by the Admin ui. Probably tied together then ...
Scott Bender
Scott Bender3mo ago
are you runnig in docker?
Skybolt
SkyboltOP3mo ago
Standard install on a 4B pi.
Scott Bender
Scott Bender3mo ago
oh, yeah, it's because of where it is finding npm instead of creating the symlink
Skybolt
SkyboltOP3mo ago
The craziness is from the real purpose of the PI. It is a Maretron Connect that I was able to open up.
Scott Bender
Scott Bender3mo ago
update the PATH to point to the nvm bin directory in /home/maretron/.signalk/signalk-server so:
#!/bin/sh
export PATH=/home/maretron/.config/nvm/versions/node/v22.17.0/bin:$PATH

signalk-server -c /home/maretron/.signalk $*
#!/bin/sh
export PATH=/home/maretron/.config/nvm/versions/node/v22.17.0/bin:$PATH

signalk-server -c /home/maretron/.signalk $*
oops fixed and remove that symlink you created ohh one more change!
Skybolt
SkyboltOP3mo ago
so edit that script?
Scott Bender
Scott Bender3mo ago
yes
Skybolt
SkyboltOP3mo ago
sorry the export threw me off. Ok trying.
Scott Bender
Scott Bender3mo ago
export makes so the child process, signalk-server, will get the new PATH
Skybolt
SkyboltOP3mo ago
ah thanks Ok rebooted, but the plugins are now failing again.
Scott Bender
Scott Bender3mo ago
and it says you can't update the server?
Skybolt
SkyboltOP3mo ago
yes
Scott Bender
Scott Bender3mo ago
that is so strange
Skybolt
SkyboltOP3mo ago
yes it is
Scott Bender
Scott Bender3mo ago
it's like the child process is not inheriting the PATH veriable something with that OS
Skybolt
SkyboltOP3mo ago
exactly, and why I used th elink. I had also tried putting htaat in the /etc/profile file. But that also failed.
Scott Bender
Scott Bender3mo ago
I guess go back to the symlink, and you'll have to do updates manually
Skybolt
SkyboltOP3mo ago
Yes, I think Maretron made it solely for them. Ok, at least there is a working solution for ht emost part. the* Thank you very much for all of your help.
Scott Bender
Scott Bender3mo ago
to update the server, just npm install -g signalk-server
Skybolt
SkyboltOP3mo ago
It is greatly appreciated.
Scott Bender
Scott Bender3mo ago
ur welcome!
Skybolt
SkyboltOP3mo ago
ok thanks.

Did you find this page helpful?