In this writeup, I will show you how to remotely program Raspberry Pi in a browser through VS Code.
How to Remotely Program Raspberry Pi Using a Browser with VS Code
To remotely program Raspberry Pi from a browser with VS Code, follow the below-given steps:
Step 1: First install Code-Server on the Raspberry Pi system from the following command:
The Code-Server is basically the server version of VS Code that can be accessed from any browser.
Step 2: Next, the user has to extend the path on the system from the following command to use Code-Server on Raspberry Pi.
Step 3: Open the Code-Server configuration file using the following command:
Step 4: Inside the file, replace the IP address “127.0.0.1” with the Raspberry Pi IP address and set the password according to your choice.
Step 5: Save the file using “CTRL+X”, add “Y” and use enter to exit.
Step 6: Run the Code-Server on the Raspberry Pi terminal from the following command:
Step 7: Go to any system browser and use the Raspberry Pi IP address with port 8080 to access the Code-Server.
While running the address on the browser, you may experience a “no-module error” as in my case.
You must create the symlink of the module in the global folder using the following command to fix the “no module found” error.
Note: You may experience multiple module errors and can fix them through the npm link command.
You must run the Code-Server multiple times until you see no module found error. Once the Code-Server runs successfully, you can then be able to access the Code-Server on the browser.
Step 8: Enter the password for Code-Server you set in Step 4 and hit the “Submit” button.
After successful login, you will see the VS Code on the browser.
At this point, the VS Code server is successfully set up on your Raspberry Pi system and you can access the Code-Server remotely using the Raspberry Pi’s IP address.
Conclusion
Code-Server is a web-based VS Code server that allows users to program with VS Code on the browser. You can set up the Code-Server on the Raspberry Pi system by installing the script and extending the path to the system. After that, you have to make some changes inside the Code-Server configuration file and then access it on the browser using the Raspberry Pi IP address. In case you experience a “no module found” error, you can fix it by creating the symlink of the module in the global folder from the “sudo npm link” command.