I'm looking to downgrade my version of nodejs from v6.11.2 to v6.10.3.. I don't know of a way to download a specific version since the closest option from nodesoure.com is curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
, which gives me v6.11. It doesn't appear that nvm
or n
work for WSL and nvm for windows
wouldn't work since I'm using bash on Ubuntu.
Personally I use nvm (node version manager) to manage the versions of node and npm that I'm using inside WSL.
Install instructions here: https://github.com/creationix/nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
nvm install 6.10.3
nvm use 6.10.3
Downgrading node package works exactly like downgrading any other package in linux:
sudo apt-get install <package-name>=<package-version-number>
OR
sudo apt-get -t=<target release> install <package-name>
Additionally use
apt-cache showpkg <package-name>
lists all available versions. (h/t [Sparhawk][]) apt-mark hold <package-name>
"holds" the package at the current version, preventing automatic upgrades. Windows 10 Home, Version 10.0.17134 Build 17134
ie n --version output: 2.1.11
Start up windows subsystem for linux bash prompt by typing Win key followed by wsl
Then, install using the following sequence:
sudo apt-get install nodejs-legacy
sudo apt-get install npm
sudo npm install -g n
sudo n lts
sudo npm install npm@lts -g
sudo chown -R $USER:$(id -gn $USER) /home/aal/.config
IMPORTANT NOTE:
chown
command above to reflect your home directory in WSL.After restarting the WSL bash window:
$ node --version
v8.11.2
$ npm --version
5.6.0
Tried installing other node versions, using
sudo n install latest
And got:
$ node --version
v10.4.0
$ npm --version
6.1.0
If you're on node v6.11.2 and want to downgrade to node v6.10.3, uninstall node & follow below instructions for the version you want:
sudo apt remove -y nodejs
curl -sL https://deb.nodesource.com/setup_10.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.