I did a fresh install of my Pi with the imaged supplied by Sphero.
Going to try to document my steps of getting the nodejs SKD up and running. This might come in handy if others find this thread later on
First step is to clone the repository found here: GitHub - sphero-inc/sphero-sdk-raspberrypi-nodejs: Sphero SDK to run on Raspberry Pi using a Node.js RESTful web api and web sockets.
Place it whereever you like on your Pi. Should not matter at all. I placed mine in my home directory for simplicity.
(Installing typescipt might be done with sudo npm install, I did it manually this time)
Since your Pi does not come with typescript installed by default you need to install it. I did this using npm:
npm install typescript
This installed typescript version:
You should now hopefully be able to run:
sudo npm install
That should install all dependecies needed. This will give you warning, as long as there are no errors you should be fine.
Next step is to build the project. This should be done with:
sudo npm build run
This will probably fail for you and give you an error that looks like @Smugly post above this one.
To get rid of the error you need to edit the file
and remove one of the three / on line 35.
If you now try and run:
sudo npm run build
again you will notice other errors surfacing. This is solved by editing tsconfig.json.
Under “compilerOptions” add the line “skipLibCheck”: true wherever you like. I added it last.
You should now be able to build the project with
sudo npm run build
If you manage to build the project without errors you should be able to get the node server up and running with:
sudo npm run start
The server starts in debug mode so there should be quite a lot of output.
Swagger should be running on ip-add-of-pi:2010/api-docs/
If you are unsure of the Pi’s IP address
Prints current local IP.
According to other posts on this forum, some endpoints in the nodejs SDK are wrong. This means that some of the commands from Swagger will not work. I have no idea which of them work and which of them dont. You will have to try it out for yourself
Disclaimer: This works for me, this does not mean that it will work for others. I have no idea if skipping a Lib check is bad practice, it probably is. But seeing that most will use this for personal projects I dont see any harm in doing it.