简体   繁体   中英

Unable to install nodejs in ubuntu v-20.04.1

I am trying to install nodejs version 14.15.4 using this command-

apt install nodejs=14.15.4

But I am getting this error- E: Version '14.15.4' for 'nodejs' was not found

Which mistake I am doing in this command?

Or any better way to install it?

The easiest way (from my experience) has always been using node version manager , as it allows you to switch between node.js versions easily. To begin, make sure you're up to date: sudo apt update .

Install NVM first using either cURL or wget using one of the following:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

We then need to load NVM, which can be done with:

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Then, use nvm install 14.15.4 .

I am trying to install nodejs version 14.15.4 using this command-

apt install nodejs=14.15.4

But I am getting this error- E: Version '14.15.4' for 'nodejs' was not found

Which mistake I am doing in this command?

Or any better way to install it?

To install Node.js v14.x in Ubuntu 20.04

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash - 
sudo apt-get install -y nodejs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM