Difference between revisions of "Getting up-to-date NodeJS & NPM"

From Da Nerd Mage Wiki
Jump to navigation Jump to search
(Created page with "= The Old Instructions = <span style="color:#8B0082">'''NOTE:''' The Ubunto repositories serve up an outdated version of Node.js. (v10.19.0)</span> <span style="color:#8B0082">Node-Red 2 requires v12... (and apparently, soon to require newer than that...)</span> [[Getting nodejs v12{{!}}Getting nodejs v12]] <span style="color:#8B0082">To determine what version you actually have once it's installed:</span> * <code><span style="color:#8B0082">nodejs -v</span></code> Any...")
 
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
= The Old Instructions =
{{{!}} class="wikitable" style="float: right; width: 322px;" border="2"
{{!}}+ Proven on:
{{!}}- < --="" debian="" -->
{{!}} style="text-align: center; width: 60px;" {{!}} [[File:Logo Debian.png{{!}}60px{{!}}link=https://www.debian.org/{{!}}center{{!}}middle{{!}}frameless]]
{{!}} style="text-align: center; width: 40px;" {{!}} 11 (bullseye)
{{!}}
 
<br>
{{!}}- < --="" ubuntu="" -->
{{!}} style="text-align: center; width: 65.7px;" {{!}} [[File:Logo Ubuntu.png{{!}}60px{{!}}link=https://ubuntu.com/{{!}}center{{!}}middle{{!}}frameless]]
{{!}} 20.04.3
{{!}}
 
<br>
{{!}}}
 
<span style="color: rgb(186, 55, 42); font-size: 24pt;">'''NOTE:'''  I take '''NO''' responsibility for daily breaking changes in the installation & update procedures from nodesource.com</span>
 
'''nodejs''' & '''npm''' versions are problematic.
 
For some reason, the versions available in all of the repositories tend to be out of date AND all attempts to update them fail in weird & wonderful ways.
 
Currently, the most up to date version of '''nodejs''' is 20.9.0 LTS
 
(You can verify the current version at [https://nodejs.org/en/ the official site])
= A WORKING Set of install instructions =
(based on [https://phoenixnap.com/kb/debian-install-nodejs this page])
 
You may need to install curl...
 
* <code>sudo apt install curl</code>
To get current version(s) on a machine WITHOUT nodejs installed yet:
* <code>curl -sL <nowiki>https://deb.nodesource.com/setup_20.x</nowiki> {{!}} sudo -E bash -</code>
** (Yes...  Big scary warning...)
* <code>sudo apt install nodejs</code>
* <code>sudo npm install npm@latest -g</code>
& verify that you have the up-to-date versions:
* <code>node -v</code>
** You should see: '''v20.5.1'''
* <code>npm -v</code>
** You should see: '''10.2.3'''
 
= If the machine already has an outdated version installed =
All instructions for updating seem to fail...
 
But!
 
Removing the installed version first is an option:
 
* <code>sudo apt remove npm</code>
* <code>sudo apt remove nodejs</code>
Then go back & start the above installation.
 
= The Old Instructions (Left here for reference...) =
<span style="color:#8B0082">'''NOTE:''' The Ubunto repositories serve up an outdated version of Node.js. (v10.19.0)</span>
<span style="color:#8B0082">'''NOTE:''' The Ubunto repositories serve up an outdated version of Node.js. (v10.19.0)</span>



Latest revision as of 21:19, 10 November 2023

Proven on:
Logo Debian.png
11 (bullseye)


Logo Ubuntu.png
20.04.3


NOTE: I take NO responsibility for daily breaking changes in the installation & update procedures from nodesource.com

nodejs & npm versions are problematic.

For some reason, the versions available in all of the repositories tend to be out of date AND all attempts to update them fail in weird & wonderful ways.

Currently, the most up to date version of nodejs is 20.9.0 LTS

(You can verify the current version at the official site)

A WORKING Set of install instructions

(based on this page)

You may need to install curl...

  • sudo apt install curl

To get current version(s) on a machine WITHOUT nodejs installed yet:

  • curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
    • (Yes... Big scary warning...)
  • sudo apt install nodejs
  • sudo npm install npm@latest -g

& verify that you have the up-to-date versions:

  • node -v
    • You should see: v20.5.1
  • npm -v
    • You should see: 10.2.3

If the machine already has an outdated version installed

All instructions for updating seem to fail...

But!

Removing the installed version first is an option:

  • sudo apt remove npm
  • sudo apt remove nodejs

Then go back & start the above installation.

The Old Instructions (Left here for reference...)

NOTE: The Ubunto repositories serve up an outdated version of Node.js. (v10.19.0)

Node-Red 2 requires v12... (and apparently, soon to require newer than that...)

Getting nodejs v12

To determine what version you actually have once it's installed:

  • nodejs -v

Anywho...

  • sudo apt install nodejs -y
  • sudo apt-get install -y build-essential
  • sudo apt install npm -y
  • sudo npm install npm@latest -g
    • NO! DO NOT UPDATE NPM!
    • (Doesn't actually seem to change anything on Debian... Updates to 8.3.0 on Ubuntu.)