卸载 npm registry 设置为淘宝镜像地址
时间: 2023-11-08 13:54:06 浏览: 84
您可以通过以下命令将npm registry(npm包管理器的默认地址)设置为淘宝镜像地址:
```
npm config set registry https://registry.npm.taobao.org/
```
如果您希望将该设置卸载,可以通过以下命令将npm registry设置为默认地址:
```
npm config set registry https://registry.npmjs.org/
```
相关问题
卸载npm,下载cnpm
### 卸载 npm
要卸载 npm,通常是因为希望彻底清理环境以便重新配置或更换工具链。然而,在大多数情况下不建议直接卸载 npm,因为 Node.js 安装时会自带 npm,并且许多开发流程依赖于它。
如果确实需要移除 npm 可以通过以下命令尝试:
```bash
npm uninstall -g npm
```
这只会删除全局安装的 npm 而不会影响到本地项目的 npm 版本[^2]。
### 安装 cnpm
对于想要使用 `cnpm` 来替代默认的 `npm` 镜像源的情况,可以直接在现有环境中安装 `cnpm`,而无需先卸载 npm。以下是具体操作方法:
#### 方法一:通过 npm 安装
确保已经安装了最新版本的 Node.js 和 npm 后执行下面这条命令来安装 `cnpm`:
```bash
npm install -g cnpm --registry=https://r.cnpmjs.org
```
此命令会在系统上全局安装 `cnpm` 工具,并设置为中国大陆地区的镜像源[^1]。
#### 方法二:直接下载脚本安装
也可以访问官方网站获取最新的安装指南或者直接运行官方提供的 shell 脚本来完成快速部署。
---
需要注意的是,安装完成后可以通过检查 `cnpm -v` 查看是否成功以及确认其版本号;另外还可以利用 `which cnpm` 或者 `whereis cnpm`(视操作系统不同)定位可执行文件的位置。
ubuntu 安装卸载nodejs npm
以下是在Ubuntu上安装和卸载Node.js和npm的步骤:
安装Node.js和npm:
1. 执行以下命令来更新可更新的软件:
```shell
sudo apt-get update
```
2. 使用apt工具安装低版本的Node.js:
```shell
sudo apt-get install nodejs
```
3. 安装nodejs-legacy和npm:
```shell
sudo apt install nodejs-legacy
sudo apt install npm
```
4. 更换淘宝的镜像:
```shell
sudo npm config set registry https://registry.npm.taobao.org
```
5. 安装更新版本的工具N:
```shell
sudo npm install n -g
```
6. 更新新的Node.js版本:
```shell
sudo n stable
```
卸载Node.js:
```shell
sudo apt-get remove nodejs
```
卸载npm:
```shell
sudo apt-get remove npm
```
阅读全文
相关推荐















