I'm happy to announce that Node.js v20.9.0 is now available on all Opalstack servers!
We've deployed the new Node.js package as a software collection. Software collections are alternate packages of system software that you can activate in your shell environment or use to run single commands single commands.
Using the new Node.js package in the shell
To activate the new Node.js package in your shell environment, add the following line to the end of your ~/.bashrc
(or equivalent configuration file if you use an alternate shell):
source scl_source enable nodejs20
Save the file, then log out and log back in. The new Node.js package will be the default for your shell session. For example:
[shelluser@opalN ~]$ node --version
v20.9.0
To activate it for a single command, prefix the command with scl enable nodejs20 --
, for example:
[shelluser@opalN ~]$ scl enable nodejs20 -- node --version
v20.9.0
Updating existing Node.js apps
If you have an existing Node.js app that uses its own bundled Node.js installation (in ~/apps/name_of_app/node
) and want to use the new Node.js for the app instead, edit the app's start
script to change this:
NODE=/home/shelluser/apps/appname/node/bin/node
to this:
source scl_source enable nodejs20
NODE=$( which node )
Note that if you've used npm install -g
to install packages into the app's Node.js installation your app will no longer have access to those packages. I recommend you install those packages into your project directory
Updated 1-click installer
We've also updated our Node.js installer with the following improvements:
- It uses the new Node.js v20.9 software to serve the app
- The default "Hello world" app is now a package run via
npm
instead of a standalone script. This makes the default project more like the real projects you'll be running, making it easier to adapt the installation to your own projects. To learn more, please see our updated documentation at: Node.js > Deploying your own Node.js project
You can create a new Node.js by clicking "Add Application" at https://my.opalstack.com/apps/ and selecting Node.js as the application type.