Меню Рубрики

Linux node js update

Как обновить Node.js на Windows, Linux и Mac

Этим вопросом задаются многие новички. Они не знают правильного и эффективного способа, и именно для них наш сегодняшний материал. Стоит отметить, что вариантов, как обновить Node.js достаточно много. Я постараюсь рассмотреть каждый из них в отдельности, включая, кстати, операционные системы, на которых будут производиться нужные действия.

Как обновить Node.js на Windows

Самым простым и очевидным способом здесь будет использование готового Bash-скрипта для Windows. С его помощью можно не только установить актуальную версию Node.js, но и произвести другие, не менее важные операции. Например, вы можете установить сразу несколько версий Node.js, и переключать их в зависимости от своих потребностей. Реализуется это через специальные команды:

Само обновление же можно воспроизвести и с помощью такой последовательности действий:

Устанавливаем менеджер версий Node.js n:

Выбираем нужную версию Node.js:

1. Стабильная версия

2. Последняя версия

3. Установка определенной версии

4. Удаление определенной версии

Помимо всего прочего, вы можете загрузить актуальную версию Node.js на официальном ресурсе Node.js. Там доступны установочные пакеты MSI, архивы zip и tar.gz, также версии для Linux и Mac.

Другие способы установки и обновления Node.js на Windows

В 2017 году на разных ресурсах описывают еще один, более актуальный способ, который был рекомендован одним из зарубежных «гуру» в своем блоге. Чтобы обновить Node.js нам нужно воспользоваться таким алгоритмом:

Узнаем какую версию Node мы используем:

Просмотрим доступные для установки версии, а также используемую:

Выведем список доступных версий:

Установим нужную версию (предположительно 1.1.1):

Для включения более старой версии используем команду:

Не могу ничего сказать по поводу эффективности данного метода, однако вы можете самостоятельно проверить его, после чего отписать в комментариях о результате.

Также вы можете использовать этот, самый простой, по моему мнению, способ:

1. Запускаем cmd от имени администратора

2. Последовательно выполняем две команды:

Данный способ рекомендован разработчиками npm, поэтому вам стоит обратить внимание на него.

Как обновить Node.js на Linux

Как и в случае с Windows, здесь мы будем использовать менеджер npm. Здесь он доступен по другому адресу на GitHub. Большая часть команд совпадает с вышеописанными, поэтому вам следует лишь повторить их, предварительно установив NPM на свою версию Linux.

Кстати говоря, если вы используете Arch Linux (или производные дистрибутивы), обновление для Node.js будет установлено автоматически при следующем апгрейде системы.

Как обновить Node.js на Mac

И снова здесь актуален способ с NPM, вы можете использовать абсолютно те же команды, что и для Windows с Linux. Однако сейчас мы рассмотрим альтернативной вариант, подразумевающий работу с менеджером пакетов Homebrew.

После установки вам достаточно будет выполнить одну единственную команду:

Источник

Как обновить Node.js в Ubuntu?

Как обновить версии NPM и Nodejs на Ubuntu 16.04?
Когда устанавливал через apt-get:
sudo apt-get install npm
sudo apt-get install nodejs
Он установил только старые версии:
$ nodejs -v
v4.2.6
npm -v
3.5.2
После чего при установки ангуляр выскакивает вот такая ошибка:
$ npm install -g @angular/cli
npm ERR! Linux 4.10.0-28-generic
npm ERR! argv «/usr/bin/nodejs» «/usr/bin/npm» «install» «-g» «@angular/cli»
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=write EPROTO
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network ‘proxy’ config is set properly. See: ‘npm help config’

Источник

updating nodejs on ubuntu 16.04

I was recently going through the version of node in my ubuntu 16.04 when node -v command was used it shows me version 6.9.1 but when nodejs -v it shows 6.9.2 previously before using this commands npm update command was used.

Now what’s these difference in node -v and nodejs -v ? and how to update to the latest LTS version of node/nodejs?

11 Answers 11

To update, you can install n

or a specific version

node v10 (Old):

node v12 LTS (For new users: install this one):

node v13 :

node v14 (Current version):

Other older versions: Just replace the desired version number in the link above.

Optional: install build tools

To compile and install native packages

To update node to latest version just:

To keep npm updated

To find out other versions try npm info npm and in versions find your desired version and replace [version-tag] with that version tag in npm i -g npm@[version-tag]

Install it:

Test your installation:

close your current terminal, open a new terminal, and run:

Use it to install as many versions as u like:

List installed versions:

Use a specific version:

Set defaults:

Use sudo apt-get install —only-upgrade nodejs to upgrade node (and only upgrade node) using the package manager.

The package name is nodejs , see https://stackoverflow.com/a/18130296/4578017 for details.

You can also use nvm to install and update node.

Then restart the terminal, use nvm ls-remote to get latest version list of node, and use nvm install lts/* to install latest LTS version.

nvm is more recommended way to install or update node, even if you are not going to switch versions.

Use n module from npm in order to upgrade node

To upgrade to latest version (and not current stable) version, you can use

sudo apt-get install —reinstall nodejs-legacy # fix /usr/bin/node sudo n rm 6.0.0 # replace number with version of Node that was installed sudo npm uninstall -g n

Difference: When I first installed node, it installed as ‘nodejs’. When I upgraded it, it created ‘node’. By executing node, we are actually executing nodejs. Node is just a reference to nodejs. From my experience, when I upgraded, it affected both the versions (as it is supposed to). When I do nodejs -v or node -v, I get the new version.

Upgrading: npm update is used to update the packages in the current directory. Check https://docs.npmjs.com/cli/update

To upgrade node version, based on the OS you are using, follow the commands here https://nodejs.org/en/download/package-manager/

Please refer nodejs official site for installation instructions at the following link

Anyway, please find the commands to install nodejs version 10 in ubuntu below.

Edit or create the file :nodesource.list

Run these commands:

Run these commands:

Use n module from npm in order to upgrade node sudo npm cache clean -f sudo npm install -g n sudo n stable To upgrade to latest version (and not current stable) version, you can use sudo n latest

To undo: sudo apt-get install —reinstall nodejs-legacy # fix /usr/bin/node sudo n rm 6.0.0 # replace number with version of Node that was installed sudo npm uninstall -g n

Not the answer you’re looking for? Browse other questions tagged node.js ubuntu or ask your own question.

Linked

Related

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2020.9.18.37632

Источник

How can I update my nodeJS to the latest version?

I have installed nodeJS on Ubuntu with following code

Since I am a new user for ubuntu I also ran this code too

I checked and saw latest nodeJS version is 0.10.26

How can I update my version of nodeJS to 0.10.26 ?

14 Answers 14

Use n module from npm in order to upgrade node

To upgrade to latest version (and not current stable) version, you can use

You may need to restart your terminal to see the updated node version.

Complete installation instructions have since been uploaded here by Nodesource. It is copied below for your reference. Instructions are the same for updating to the latest version.

If you don’t like curl . | sudo bash — then you can follow the manual instructions, which tells you how to add the Node.js repository to /etc/apt/sources.list.d/ yourself.

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 6.x on older distros

Node.js v13.x:

Node.js v12.x:

Node.js v11.x:

Node.js v10.x:

Node.js v9.x:

Node.js v8.x:

Node.js v7.x:

NOTE: Debian Wheezy and Ubuntu Precise packages are NOT available for this release. Please reference running Node.js >= 4.x on older distros

Node.js v6.x:

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros.

Node.js v5.x:

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros.

Node.js v4.x:

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros.

Node.js v0.12:

Node.js v0.10:

io.js v3.x:

io.js v2.x:

io.js v1.x:

Note: this branch of io.js is not actively maintained and is not recommended for production use.

I also recommend using nvm instead, and also removing the already installed version to avoid conflicts in the terminal

then install nvm and use it

Video Explanation

should download and install the latest version of node.

To update node later on just do

This PPA is out of date and not maintained anymore; you should consider other answers instead of this one.

You can install the latest version from PPA:

I use NVM to handle my Node versions. Very simple to set up and easy to use.

To install NVM globally instead, use the following curl command instead of the one above (and presumably don’t use the second command but do use the third one)

Then use nvm install stable (or insert a version number instead of stable ) to get the latest/a specific version of Node. Use nvm use stable (or a specific version number) to use that Node version. Use nvm ls to see what Node versions you have installed and nvm uninstall stable (or a specific version number) to remove a specific version of Node.

NVM (Node Version manager) with —lts

NVM was mentioned at: https://askubuntu.com/a/441527/52975 but here goes a more complete usage example, including the sane —lts version, which installs the latest Long Term Support version of Node, which is likely the one you want if you don’t have more specific requirement.

Install NVM and the latest Node LTS version:

Now test it out with a dummy package:

Since the sourcing has to be done for every new shell, the install script hacks adds some auto sourcing to the end of your .barshrc . That works, but I prefer to remove the auto-added one and add my own:

allows you to use multiple versions of Node and without sudo

is analogous to Ruby RVM and Python Virtualenv, widely considered best practice in Ruby and Python communities

downloads a pre-compiled binary where possible, and if not it downloads the source and compiles one for you

We can easily switch node versions with:

With this setup, you get for example:

and if we want to use the globally installed module:

so we see that everything is completely contained inside the specific node version.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Recuva для mac os
  • Recovery режим mac os
  • Recovery mode mac os sierra
  • Recovery hd mac os что это
  • Recovery hd mac os как запустить