When using the conda command to install nodejs directly, it may be impossible to install a higher version of nodejs because the version of nodejs in the image source is too low, resulting in the inability to use some extensions in jupyterlab.
The solution is as follows: (In the windows environment, just follow the prompts to download the version and install it. Here we only introduce the solution for the linux environment)
1. Go to the official website to download nodejs.
2. Follow the github steps to install.
github original link Installation · nodejs/help Wiki · GitHub
Step 1 Unzip the installation file to the directory where nodejs needs to be installed.
Open the terminal and execute the following command. in:
VERSION and DISTRO correspond to the version number and system environment in the file name of the downloaded file, respectively.
/usr/local/lib/nodejs is the installation directory of nodejs, which can be adjusted by yourself.
VERSION=v18.14.0
DISTRO=linux-x64
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs
step2 set environment variables
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
step3 Refresh the profile file
. ~/.profile
step4 establish soft connection
Up to the previous step, you can query the nodejs version through node -v in the current directory, but you still need to execute the following command, so that you can query it by executing node -v in any file directory.
Among them, [usr/local/lib/nodejs/nodejs/node-v18.14.0-linux-x64/] is the installation path of nodejs, which needs to be adjusted according to the installation path.
ln -s /usr/local/lib/nodejs/nodejs/node-v18.14.0-linux-x64/bin/node /usr/local/bin/
ln -s /usr/local/lib/nodejs/nodejs/node-v18.14.0-linux-x64/bin//npm /usr/local/bin/
3. Confirm the installation result
Execute the following command to check the node version number to confirm whether the installation is successful.
node -v