How to install lastest version of Node and NPM for Linux Debian?

只谈情不闲聊 提交于 2021-02-11 12:50:32

问题


I have a Debian Jessie and latest Node version available with apt is 8.9.0.

What's the easy way to install the latest version aka 11.3.0 ? (and the latest NPM also)


回答1:


I think easiest way to manage Node.js versions is to use n

Installation

$ curl -L https://git.io/n-install | bash

Usage

$ n 11.3.0 #Install node 11.3.0 version
$ n latest #Install or activate the latest node release
$ n stable #Install or activate the latest stable node release



回答2:


The easier way seems to be :

INSTALLATION

  1. Go to https://nodejs.org/en/download/current/ and copy url of your architecture Linux binaries (here Linux Binaries x64)
  2. Install xz-utils if needed : sudo apt-get install xz-utils
  3. write these commands

commands :

wget https://nodejs.org/dist/v11.3.0/node-v11.3.0-linux-x64.tar.xz
unxz node-v11.3.0-linux-x64.tar.xz
sudo tar --directory /usr/local --strip-components 1 -xf node-v11.3.0-linux-x64.tar
rm node-v11.3.0-linux-x64.tar

It should untar the archive in /usr/local which is already in the PATH and secure_path.


TEST

node -v return v11.3.0

npm -v return 6.4.1


UPDATE

To update, just make the same with new version and update NPM packages with npm update (not tested yet).



来源:https://stackoverflow.com/questions/53592607/how-to-install-lastest-version-of-node-and-npm-for-linux-debian

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!