Getting VS Code to recognize flatpak nodejs

In the past when I have used apt to install nodejs, the apt installation script automatically configures everything and adds the node environment variable to my system. The end result is that I fire up VS Code (or insert code editor of your choice) and start writing JavaScript. When I’m ready to test, I run the code and see the results in the output console.

With the flatpak nodejs found in the app center, this isn’t the case and VS Code doesn’t see node. What can I do to get Endless to see that nodejs is available system-wide? Thanks.

That does not work that way :slight_smile:

A short explanation:

The Flatpak you installed was NodeJS SDK Extension for the Freedesktop platform. This extension can be used by Flatpak Developers/Packagers to include the NodeJS Runtime environment in the Flatpak if the packaged application depends on it.

Solution

To simply use VS Code to develop some piece of code and execute it with NodeJS, you need to install the NodeJS environment outside the Flatpak Sandbox:

cd ~/Downloads
wget https://nodejs.org/dist/v15.13.0/node-v15.13.0-linux-x64.tar.xz
xz -dc node-v15.13.0-linux-x64.tar.xz | tar -xvf - -C ~

This will install NodeJS to your Homedirectory (under ~/node-v15.13.0). Now you want to add this to the PATH environment:

echo export PATH=\${PATH}:~/node-v15.13.0-linux-x64/bin >> ~/.profile

Reboot for the added PATH to take effect. In a Terminal you can use node and npm:

image
Now install the necessary VS Code Plugins which assist you in Node development

1 Like

Gracias. That’s a big help.