Home > Mobile >  Installing node js and npm on Vanilla os
Installing node js and npm on Vanilla os

Time:01-26

I'm trying to install node js and npm on vanilla os. I've tried flatpak install method as well but it didn't work. Any help will be much appreciated.

CodePudding user response:

If you are planning to use nodejs on top of Visual Studio Code (installed as a Flatpak) then the version you installed from Flathub is fine but you need to change the environment variables of Code to detect that SDK. To do this:

flatpak override --user --env=FLATPAK_ENABLE_SDK_EXT=* com.visualstudio.code

this will enable/expose any SDK you install via Flatpak.


If instead your aim is to use it outside the Flatpak context, you can install the nodejs package from the Ubuntu repository using apx, the distribution's package manager:

apx install nodejs

You can get a more recent version installing it from the Fedora or Arch Linux repository, using the --dnf (for Fedora) or --aur (for Arch linux), so:

apx install --dnf nodejs
# or
apx install --aur nodejs

Then to use it you can proceed with one of the following methods:

entering the Apx container

apx enter
# or apx --dnf enter
# or apx --aur enter
# then
npm ...

using the run option

apx run npm ..
# or apx --dnf run npm ..
# or apx --aur run npm ..

It is also possible (but not recommended) to install nodejs directly on the host system. To do this you need to use the abroot command which allows you to create an atomic transaction which can make changes to the system:

sudo abroot exec apt install nodejs

it will ask you to reboot to apply the changes (if the transaction succeed).

  • Related