Page 3 of 4

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 2:53 pm
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.

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 2:59 pm
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! :)

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 3:49 pm
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.

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 5:41 pm
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:

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 5:43 pm
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

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 6:22 pm
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.

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 8:31 pm
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

Re: How to install LTS Nodejs

Posted: Tue Feb 06, 2018 11:20 pm
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.

Re: How to install LTS Nodejs

Posted: Wed Oct 03, 2018 11:47 pm
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.

Re: How to install LTS Nodejs

Posted: Mon Jan 28, 2019 10:09 am
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.