野声

Hey, 野声!

谁有天大力气可以拎着自己飞呀
twitter
github

Install nvm and nodejs

After seeing the artifact nvm online, I have been using nvm to install Nodejs recently.
Just installed Linux Mint, and reinstalled nvm on Linux. There is also a similar tool on Windows called nvm-windows, and the usage is similar.

GitHub link: https://github.com/creationix/nvm

nvm is a version control tool for nodejs, which stands for "Node Version Manager" in the first three letters.

Updated on 2019-06-29: Installing nvm on Windows

Installing nvm on Linux#

Installing and upgrading nvm#

To install or upgrade nvm, you can use the official script provided.

You can use curl:

Or wget:

If your machine is in China, raw.githubusercontent.com is blocked, you can use the reverse proxy provided by fastgit.org: https://raw.fastgit.org/.

The current official version is v0.34.0.
You can install the latest version from the link provided above.
This script will clone the remote repository of nvm to the ~/.nvm path and add activation code to your terminal's configuration file.

After executing this command, everything is installed.
But in China, you still need to configure a proxy, which is not necessary if you don't need it.

Configuring git proxy#

I use electron-ssr locally, and the proxy address is socks5://127.0.0.1:1080.
Execute the following command to set the proxy for GitHub.

Note that this method does not support proxy for ssh. That needs to be configured separately. I won't go into detail here, I will write another blog post to explain how to configure ssh proxy.

The configuration on the command line will also modify the .gitconfig file in the user's directory. This applies to both Windows and Linux.

In other words, the same effect can be achieved by modifying ~/.gitconfig:

Configuring terminal proxy#

Because the commands in the terminal do not use the system proxy, you can use software like proxychains4 to proxy the commands.

After configuring proxychains4, use:

to install.

Configuring zsh#

After installing nvm, I found that I only wrote the startup configuration to ~/.bashrc on my local machine, so I manually copied the configuration to ~/.zshrc.

Then execute source ~/.zshrc, and you're done.

Installing nodejs#

Configuring nvm download source#

Execute:

to set the download source to the domestic Taobao mirror.

Installing nodejs with nvm#

Execute:

That's it~

Basic usage of nvm#

See: https://github.com/creationix/nvm#usage

I only use a few commands myself, and actually only need to master these few commands:

Configuring npm registry#

You can configure several domestic registries in one go~

That's All.

Installing nvm on Windows#

Download and install#

nvm-windows

Download the latest version of nvm-windows in Releases. If you downloaded nvm-noinstall.zip, you need to configure the environment variables.
Here I directly installed the setup version, and after installation, enter nvm in cmd. If it is displayed, the installation is successful.

Configuring domestic source#

You can set nvm to download and install from China.
See the previous section for installing nodejs: Configuring npm registry

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.