Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

brew node switch version

# install LATEST stable version of node
$ brew install node

# install OLD version of node
$ brew install node@8

# check version of installed node
$ node -v
v10.4.1

# unlink LATEST version of node
$ brew unlink node

# link OLD version of node
$ brew link node@8

# update bash profile to point to OLD version
$ echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.bash_profile
# or
$ echo 'export PATH="/usr/local/opt/node@8/bin:$PATH"' >> ~/.zshrc

# open a new terminal window and verify version
$ node -v
v8.16.1
 
PREVIOUS NEXT
Tagged: #brew #node #switch #version
ADD COMMENT
Topic
Name
9+7 =