Welcome!
Forum users

Current releases
--MX-23 release info here
--Migration information to MX-23 here
--antiX-23.1 (Arditi del Popolo) release info here

Important information
--If in starting your system it boots to an unwanted Desktop, right click desktop, then select leave and logout. At the
login screen there is a session chooser at the top of the screen.

News
-- MX Linux on social media: here
-- New Forum Features, Marking Solved and Referencing a User: here

How to install LTS Nodejs

Message
Author
User avatar
Stevo
Developer
Posts: 12745
Joined: Fri Dec 15, 2006 8:07 pm

Re: How to install LTS Nodejs

#21 Post by Stevo »

Well, we all were new to this at one time. You'll get used to it if you're going to be a coder.

Here's the modified script with the executable bit set for you. Just extract it in a directory, open a terminal there, and run

Code: Select all

sudo ./setup_8.x
What it does is add their repo and their key to your software sources, so if you have Debian's older node.js installed, you'll see their 8.9.4 as an upgrade.

We could probably add it as an option to our package installer, but that would need a bit of discussion.

Hmmm...maybe I can use their build format instead of Sid's to get successful packages for 8.9.4. Launching build.
Last edited by Stevo on Tue Feb 06, 2018 3:20 pm, edited 1 time in total.

bigbenaugust
Posts: 56
Joined: Wed Dec 20, 2017 10:41 am

Re: How to install LTS Nodejs

#22 Post by bigbenaugust »

No sorcery, just editing text.
Stepping back, the instructions at nodesource.com (https://nodesource.com/blog/installing- ... ian-linux/) say to run:

Code: Select all

sudo curl -sL https://deb.nodesource.com/setup_8.x | bash -
This downloads and runs the setup script in one line. BUT you can download it like this:

Code: Select all

curl -sL https://deb.nodesource.com/setup_8.x > ./setup_8.x
Open this setup_8.x file in any text editor you choose.
Then you can edit the little table inside of the script that says who is Debian but not reporting as such. That table starts at line 258. At the end of the table (line 281), you can add a line like this:

Code: Select all

check_alt "MX"        "Horizon" "Debian" "stretch"
This will fool the installer script into thinking that your MX machine is a Debian machine (which it is, but it doesn't report as such).

Then save the file and exit the editor.

After that, run the script:

Code: Select all

sudo ./setup_8.x
This will set up the nodesource.com repository on your machine. Once that's done, run:

Code: Select all

sudo apt update && sudo apt install nodejs
and then you will have node.js 8.x on your machine.

Ninja'd by Stevo, but here's the explanation! :)
--Ben

User avatar
Stevo
Developer
Posts: 12745
Joined: Fri Dec 15, 2006 8:07 pm

Re: How to install LTS Nodejs

#23 Post by Stevo »

I got 8.9.4 packages to build for 64-bit MX 17, so now 32-bit and MX 15/16 packages are building...so we'll have at least one set in our test repo.

User avatar
Biofobico
Posts: 14
Joined: Thu Jan 18, 2018 5:32 pm

Re: How to install LTS Nodejs

#24 Post by Biofobico »

@bigbenaugust Awesome work dissecting and make it understandable.
@stevo Guess I'll wait for the repo then.

Thank you both for the help :number1:

User avatar
Stevo
Developer
Posts: 12745
Joined: Fri Dec 15, 2006 8:07 pm

Re: How to install LTS Nodejs

#25 Post by Stevo »

They all built, so I just sent them up to the test repo. You can grab them early here until I clean out my upload gdrive: https://drive.google.com/open?id=1XHWwC ... CoiNh5J98P

User avatar
Biofobico
Posts: 14
Joined: Thu Jan 18, 2018 5:32 pm

Re: How to install LTS Nodejs

#26 Post by Biofobico »

Stevo wrote:They all built, so I just sent them up to the test repo. You can grab them early here until I clean out my upload gdrive: https://drive.google.com/open?id=1XHWwC ... CoiNh5J98P
Awesome! Thank you @Stevo.

User avatar
Stevo
Developer
Posts: 12745
Joined: Fri Dec 15, 2006 8:07 pm

Re: How to install LTS Nodejs

#27 Post by Stevo »

I found this site where you can look to see what versions of a package are in a plethora of repos, including MX's. Here's what they have for nodejs...the MX test version hasn't hit it yet: https://repology.org/metapackage/nodejs/versions

bigbenaugust
Posts: 56
Joined: Wed Dec 20, 2017 10:41 am

Re: How to install LTS Nodejs

#28 Post by bigbenaugust »

I had to figure this out to install an Electron-based MS Teams client (we use it for work) on 32-bit MX. Figured I'd share with somebody.
--Ben

pannet1
Posts: 64
Joined: Sun Aug 26, 2018 2:38 am

Re: How to install LTS Nodejs

#29 Post by pannet1 »

hi,

nodejs documentation says if i install it, i will be able to access the package manager npm. but when i installed nodejs with apt, i am not able to issue npm command.

can you please advise how to get the latest npm working in mx linux.

UPDATE: i failed to the 2 and 3 pages of this thread in the beginning since i am new to this forum. i used the setup script of nodejs

Code: Select all

curl -sL https://deb.nodesource.com/setup_8.x > ./setup_8.x
they have already added MX Linux to the setup script and hence no need to add it manually as mentioned in one of the previous post here.
mx linux 19 (KDE) - using mx linux since 17.1
x86_64 / 32-bit, 64-bit / CPUs 4 / GenuineIntel / Intel(R) Core(TM) i3-4010U CPU @ 1.70GHz

samet
Posts: 1
Joined: Mon Jan 28, 2019 9:51 am

Re: How to install LTS Nodejs

#30 Post by samet »

bigbenaugust wrote: Tue Feb 06, 2018 2:59 pm No sorcery, just editing text.
Stepping back, the instructions at nodesource.com (https://nodesource.com/blog/installing- ... ian-linux/) say to run:

Code: Select all

sudo curl -sL https://deb.nodesource.com/setup_8.x | bash -
This downloads and runs the setup script in one line. BUT you can download it like this:

Code: Select all

curl -sL https://deb.nodesource.com/setup_8.x > ./setup_8.x
Open this setup_8.x file in any text editor you choose.
Then you can edit the little table inside of the script that says who is Debian but not reporting as such. That table starts at line 258. At the end of the table (line 281), you can add a line like this:

Code: Select all

check_alt "MX"        "Horizon" "Debian" "stretch"
This will fool the installer script into thinking that your MX machine is a Debian machine (which it is, but it doesn't report as such).

Then save the file and exit the editor.

After that, run the script:

Code: Select all

sudo ./setup_8.x
This will set up the nodesource.com repository on your machine. Once that's done, run:

Code: Select all

sudo apt update && sudo apt install nodejs
and then you will have node.js 8.x on your machine.

Ninja'd by Stevo, but here's the explanation! :)
This did the trick but in another way. I tried to install node 11.x in my MX Linux 18 Continuum with your way. I ran this code but it gave me an error that says my distribution is not supported:

Code: Select all

sudo curl -sL https://deb.nodesource.com/setup_11.x | bash -

Code: Select all

## Confirming "Continuum" is supported...

+ curl -sLf -o /dev/null 'https://deb.nodesource.com/node_11.x/dists/Continuum/Release'

## Your distribution, identified as "Continuum", 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
And then I checked "https://deb.nodesource.com/node_11.x/dists/". There was no directory that is named "Continuum", of course. The script wasn't adjusting my distro settings to Debian Stretch as it intented to be. So I added these 2 lines to the "setup_11.x" file in lines 241 and 242:

Code: Select all

check_alt "MX"            "Continuum" "Debian" "stretch"
check_alt "mx-linux"      "Continuum" "Debian" "stretch"
And I ran the script again. Finally it worked and printed these lines at the beginning:

Code: Select all

## You seem to be using MX version Continuum.
## This maps to Debian "stretch"... Adjusting for you...

## Confirming "stretch" is supported...
Finally, I ran this code and installed nodejs successfully:

Code: Select all

sudo apt install -y nodejs
I don't know which one of them did the trick but it worked like a charm.

Code: Select all

$ node --version
v11.8.0
$ npm --version
6.5.0
I hope this helps to anybody.

Post Reply

Return to “Software / Configuration”