Skip to content

Using nrm

nrm is a mirror management tool for the Node.js package manager npm. It helps you quickly switch between different npm registry mirrors.

Note: After switching mirrors, if installations are slow or fail, it may be due to issues with the specific mirror! Switch to a different mirror as needed.

Global Installation of nrm

Make sure Node.js is installed and npm is working properly:

bash
npm install nrm -g

Note

If you're using nvm, you'll need to reinstall nrm after switching Node.js versions.

Common nrm Commands

bash
# Check version:
nrm -V

# Check version and installation path:
npm list -g nrm

# View mirror list:
nrm ls

# Switch to a specific mirror:
nrm use <mirror-name>

# Add a mirror:
nrm add <mirror-name> <mirror-url>
Example: nrm add taobao https://registry.npmmirror.com/

# Delete a mirror:
nrm del <mirror-name>

Default nrm Mirror List

bash
  npm ---------- https://registry.npmjs.org/
  yarn --------- https://registry.yarnpkg.com/
  tencent ------ https://mirrors.tencent.com/npm/
  cnpm --------- https://r.cnpmjs.org/
* taobao ------- https://registry.npmmirror.com/
  npmMirror ---- https://skimdb.npmjs.com/registry/
  huawei ------- https://repo.huaweicloud.com/repository/npm/

nrm

Common Issues with nrm

If you encounter an error like: "Cannot load file C:\Program Files\nodejs\node_global\nrm.ps1, because running scripts is disabled on this system. For more information, see https:/go.microsoft.com/fwlink/?LinkID=135170 about_Execution_Policies."

Solution: Run cmd as administrator and change the script execution policy

  1. Execute Start-Process powershell -Verb runAs in PowerShell (run cmd as administrator)
  2. Execute set-ExecutionPolicy RemoteSigned and enter Y (change the trusted script policy)

nrm issues

Built with VitePress