In this article, we will show you how to install the JupyterHub JavaScript/Node.js kernel on your JupyterHub server so that the JupyterHub users can run and document the JavaScript/Node.js codes on Jupyter Notebooks just as they run and document the Python codes.
NOTE: If you don’t have JupyterHub installed on your computer, you can read one of the articles depending on the Linux distribution that you’re using:
1. How to Install the Latest Version of JupyterHub on Ubuntu 22.04 LTS/ Debian 12/Linux Mint 21
2. How to Install the Latest Version of JupyterHub on Fedora 38+/RHEL 9/Rocky Linux 9
Topic of Contents:
- Installing Node.js on Ubuntu/Debian/Linux Mint
- Installing Node.js on RHEL/Rocky Linux/Fedora
- Checking If Node.js and NPM Are Installed Correctly
- Installing the JavaScript/Node.js Kernel on JupyterHub
- Checking If the JavaScript/Node.js JupyterHub Kernel Is Installed Correctly
- Conclusion
- References
Installing Node.js on Ubuntu/Debian/Linux Mint
For the JupyterHub JavaScript/Node.js kernel to work, you must have the Node.js installed on your computer. If you’re using Ubuntu/Debian/Linux Mint or any other Ubuntu/Debian-based Linux distribution as your JupyterHub server, you can install Node.js from the official package repository of your Linux distribution.
First, update the APT package database cache with the following command:
To install Node.js and Node Package Manager (NPM), run the following command:
To confirm the installation, press “Y” and then press <Enter>.
Node.js and NPM are being installed. It takes a while to complete.
At this point, Node.js and NPM should be installed.
Installing Node.js on RHEL/Rocky Linux/Fedora
For the JupyterHub JavaScript/Node.js kernel to work, you must have Node.js installed on your computer. If you’re using RHEL/Rocky Linux/Fedora or any other RPM-based Linux distribution as your JupyterHub server, you can install Node.js from the official package repository of your Linux distribution.
First, update the DNF package database cache with the following command:
To install Node.js and Node Package Manager (NPM), run the following command:
To confirm the installation, press “Y” and then press <Enter>.
Node.js and NPM are being installed. It takes a while to complete.
At this point, Node.js and NPM should be installed.
Checking If Node.js and NPM Are Installed Correctly
To confirm whether Node.js and NPM are installed correctly, run the following commands:
$ npm --version
As you can see, Node.js 12.22.9 and NPM 8.5.1 are installed on our Ubuntu 22.04 LTS operating system.
Installing the JavaScript/Node.js Kernel on JupyterHub
JupyterHub adds the JavaScript/Node.js support through the use of IJavaScript. To install the IJavaScript Node.js package on your computer, run the following command:
The IJavaScript Node.js package is being installed. It takes a few seconds to complete.
The IJavaScript Node.js package should be installed at this point.
Once the IJavaScript Node.js package is installed, you have to install the JupyterHub IJavaScript kernel to enable the JavaScript/Node.js support on JupyterHub notebooks.
First, activate the JupyterHub virtual environment with the following command:
To install the JupyterHub IJavaScript kernel system-wide (for all JupyterHub users), run the following command:
Checking If the JavaScript/Node.js JupyterHub Kernel Is Installed Correctly
You can check whether the JavaScript/Node.js JupyterHub kernel is installed, run the following command:
You should find the JavaScript/Node.js kernel in the available kernels list.
If you log in to JupyterHub, you should find the JavaScript (Node.js) programming language in the “Notebook” section.
To create a JavaScript/Node.js Jupyter notebook, click on JavaScript (Node.js) from the “Notebook” section.
A new JupyterHub JavaScript/Node.js notebook should be created.
You can write and document the JavaScript/Node.js codes in the same way as you do in Python codes.
Conclusion
In this article, we showed you how to install Node.js and IJavaScript on Ubuntu/Debian/Linux Mint/RHEL/Rocky Linux/Fedora and other Ubuntu/Debian-based and RPM-based Linux distributions. We also showed you how to install the JavaScript/Node.js kernel on JupyterHub so that you can run and document the JavaScript/Node.js codes on Jupyter notebooks just as you do in Python codes.