Options to install node.js on fedora silverblue

Hey Mates,

What options do I have to install node.js in Fedora Silverblue. Is it only possible in a toolbox? How can I then use node.js via my IDE (Intellij Idea), which I installed via flatpak. Or is there, contrary to expectations, an rpm-ostree package? Thank you for your effort and have a nice weekend

Cheers

Dirk

2 Likes

I don’t use a Toolbox for this, I prefer a node environment manager so I can use different versions in different projects. There are several ways you can do this. I use Volta, but there are plenty of other solutions, like nvm and fnm.

Volta’s installer doesn’t work on Silverblue (unless you rpm-ostree install openssl first to get missing utils), but Volta itself works without a hitch, you just have to install it manually:

mkdir -p ~/.volta/bin
cd ~/.volta/bin
wget https://github.com/volta-cli/volta/releases/download/v1.0.4/volta-1.0.4-linux-openssl-1.1.tar.gz
tar xvfz *.tar.gz && rm *.tar.gz
./volta setup

Then you can follow the docs, but the simple version is what I do:

cd MY_PROJECT_THAT_USES_NODE
# If you don't already have a node-version/nvmrc file, I like to set major version in file
echo '14' > .node-version 
# Install latest node with volta install node or use version:
volta install node@$(cat .node-version)
# Install classic yarn (1.x)
volta install yarn # or npm if you prefer 

You can also pin version in package.json with volta pin, but I don’t recommend this because it supposes that all collaborators use it.

When it comes to flatpak IDE, that’s a whole different ballgame. There are several threads about this. In short, I don’t think it’s worth the effort. I layer neovim myself, but I’ve also used vscode through Toolbox. Works well!

1 Like

You can rpm-ostree layer any Fedora package - there’s no special “rpm-ostree package”. That being said, installing node.js and npm on the host won’t do you much good, since your IDE will have no more access to host environment than it does to the environment inside a toolbox.It will only see what’s available in the Flatpak sandbox.

Options you have:

  • Install the IDE in your home directory, and run it from within the toolbox environment. You’ll have to launch it from the command line or add your own desktop file within ~/.local/share/applications.
  • Install the org.freedesktop.Sdk.Extension.node10 Flatpak SDK extension. As long as you just need NPM and the IDE, this works fine, but your development environment will have no access to Fedora packages or utilities.

Bridging between a Flatpak installed IDE and a Toolbox only really works for GNOME Builder or Visual Studio Code at the moment.

1 Like

Thx for the detailed explanations.
I will try both answers
Cheers

Hey Even and Owen,

I have an update and I was able to install node.js and my ide via binaries. So I was able to overcome the hurdles and was even able to learn something about how Silverblue works.

Here is the route again for me (if I have to remember :slight_smile: )and of course other interested parties:

FOR NODE:
Binary files from:

Unpacking with the console:
$ sudo tar -xzf nodefile.tar.gz -C / path / u / may / write /

Go to DIR and look for README.md and BUILDING.md for further informations
Then, I was able to use the console
(Before i must install make and g++ with: rpm-ostree install g++ make)
$ sudo ./configurate
./make -j4
./make install

For IDE:
Installation Instructions

  1. Unpack the idea idea-2021.1.1.tar.gz file to an empty directory using the following command:
    $ sudo tar -xzf idea- 2021.1.1.tar.gz -C / path / u / may / write /
    Note: A new instance MUST NOT be extracted over an existing one. The target folder must be empty.
  2. Run idea.sh from the bin subdirectory.

In Main Menu we can create in desktop shortcut and find java jdk, python jdk and also node.js

Cheers and many thanks for the showing ways

Dirk