Open mcelhinnysp opened 1 week ago
I think i know how you can fix this.
Source of the problem: You have not set up a system variable for node for your root user. I think this should be fixable by just reinstalling it as the root user or setting up a variable. (ask chatgpt to set it up so you dont need the absolute path as root)
Alternatively, you can modify onboard/standby/runner.js as you can see on line 36, the program expects a node system variable to be present. You can fix this by changing this line to noca = spawner("/home/test/.nvm/versions/node/v14.21.3/bin/node ./driver/index.js")
Background
I have installed nodejs v14.21.3 using nvm onto a fresh 64 bit raspberry pi 4 model B. I have followed the readme instructions to the best of my experience, albeit very limited. I have installed pigpio and socat as covered in the github readme. After running npm install into the onboard folder, I run the program (elevated with sudo, see below). It connects, but when I click start from the webserver interface, the /bin/sh error appears. I have no experience in this area, any guidance would be appreciated.
All code has been run from Raspberry Pi terminal.
After running npm install, I tried running as called in the readme.
Non-Elevated Approach
This is based on code from the readme
Elevated Approach
Based on the guidance in the error, I tried running as with elevated access
Attempt without absolute node path
test@raspberrypi:~/Documents/LTE car/LTE-Car-main/onboard $ sudo node index.js sudo: node: command not found
The pi did not connect at all in this case
Attempt with absolute node path
Based on some interaction with ChatGPT, I tried the absolute node path
test@raspberrypi:~/Documents/LTE car/LTE-Car-main/onboard $ sudo /home/test/.nvm/versions/node/v14.21.3/bin/node index.js standby service ready [192.168.1.126] [LTE-Car Error]: /bin/sh: 1: node: not found
The absolute path was obtained by running:test@raspberrypi:~/Documents/LTE car/LTE-Car-main/onboard $ which node /home/test/.nvm/versions/node/v14.21.3/bin/node
I am very inexperienced with linux, nodejs, and the raspberry pi, so any guidance would be appreciated. Thanks!