[CENTOS] Coexist multiple versions using Node.js n

I had the opportunity to use node.jp at work, I have the opportunity to use different node versions on multiple systems, and now I can switch node versions in virtual environments (CentOs)

Node.js and npm installation

For now, install node and npm (CentOs)

yum install gcc gcc-c++
yum install nodejs npm –enablerepo=epel
brew install node

n installation

npm install -g n

Pass n paths

Specify the path using ~ / .bash_profile

cd
vi .bash_profile

Buy the following wording in .bash_profile

export N_PREFIX=$HOME/.n
export PATH=$N_PREFIX/bin:$PATH

Apply adjustment

source .bash_profile

Now you're ready!

Installation of a specific version

newest version

$ n –stable
$ n –latest
$ n latest

Specific version

$ n 5.7.1

Version switching

You can switch between the arrow keys and the Enter key using the n command.

# n

ο   node/10.17.0
    node/12.18.3

Use up/down arrow keys to select a version, return key to install, d to delete, q to quit

Now you can easily switch the version of node, it really helps

References

https://qiita.com/jaxx2104/items/2277cec77850f2d83c7a https://blog1.mammb.com/entry/2019/11/26/090000 https://qiita.com/bigplants/items/2d75bf552e0da4a7e822

Recommended Posts

Coexist multiple versions using Node.js n
Install multiple versions of Polyphony using venv
Using multiple versions of Python on Mac OS X (2) Usage
Draw multiple graphs using Pandas
Install multiple versions of Python
Using multiple versions of Python on Mac OS X (1) Multiple Ver installation