问题
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
- Go to https://nodejs.org/en/download/current/ and copy url of your architecture Linux binaries (here Linux Binaries x64)
- Install
xz-utils
if needed :sudo apt-get install xz-utils
- 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