'Deepin 20 and updated Nodejs

Does anyone have a solution to get current node / npm versions on Deepin 20?

When trying to install from nodesource I get this:

Confirming "n/a" is supported...

  • curl -sLf -o /dev/null 'https://deb.nodesource.com/node_14.x/dists/n/a/Release'

Your distribution, identified as "n/a", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support



Solution 1:[1]

Although Deepin 20.2 can install Node JS directly from the apt, the version is too old and not maintained anymore.

In addition, the official installation method of NodeJS is problematic as it does not support the Deepin system.

So you need to look at this script setup.14.x to find the actual installation method. Of course, it might be simpler if you already have it installed on Debian or Ubuntu.

You have to completely uninstall Deepin's own version before installing the official version.

sudo apt remove nodejs npm
sudo apt autoremove

Add the following content to

/etc/apt/sources.list.d/nodesource.list:

deb https://deb.nodesource.com/node_14.x buster main
# deb-src https://deb.nodesource.com/node_14.x buster main

Then add the official key and you can install it directly.

curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
sudo apt update
sudo apt install nodejs

Problem fixed with Experience.

Solution 2:[2]

Deepin isn't listed as a supported distro for NodeSource.

As a Debian derivative, something like this should work:

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_14.x | bash -
apt-get install -y nodejs

Otherwise you might try a manual install. If you do, you'll need to specify the buster codename since Deepin 20 is based on Debian 10.5.

Solution 3:[3]

This is what worked for me to install NodeJS 12. Paste in terminal the following

VERSION=node_12.x

DISTRO="$(dpkg --status tzdata|grep Provides|cut -f2 -d'-')"

echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list

echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list

sudo apt-get update

sudo apt-get install nodejs

this should work for Deepin 20

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MWO
Solution 2
Solution 3 David Barrientos