0
sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
nodejs is already the newest version (12.22.12~dfsg-1~deb11u3).

Since node 12.X isn't the latest version, how do I update it?

When I try to run my Ionic application, I get an error message

└──╼ $ionic serve
> ng run app:serve --host=localhost --port=8100
[ng] Node.js version v12.22.12 detected.
[ng] The Angular CLI requires a minimum Node.js version of either v14.20, v16.13 or v18.10.
[ng] Please update your Node.js version or visit https://nodejs.org/ for additional instructions.

[ERROR] ng has unexpectedly closed (exit code 3).
        
        The Ionic CLI will exit. Please check any output above for error details.

On reboot, if the greater version was successfully installed, it reverts to the default version

1 Answers1

0

I used nvm(node version manager) to manage all my node versions (you should too) and I installed it like this under Parrot OS (it is similar to other Systems).

Remove old nodejs and npm if installed:

  1. sudo apt remove -y npm
  2. sudo apt remove -y nodejs

Create .bashrc if it does not exists. For me there was only the .zshrc by default on Parrot OS.

  1. touch ~/.bashrc

Get nvm via curl:

  1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
  2. source ~/.bashrc

Install Node with nvm:

  1. nvm install node (installs the latest stable version)

Check if you have the version you like. Type nvm if you wanna see how to install or switch to other versions.

  1. node --version

Now run your ng command again to check if it works.

WastedFreeTime
  • 195
  • 2
  • 3
  • 16