你好,我是悦创。
默认的官方镜像: https://registry.npmjs.org,切换国内淘宝镜像,访问下载更快。
1. npm 设置
::: code-tabs
- 查看源
- 设置淘宝源
- 切回官方镜像
- npm 临时使用
2. yarn 设置
- 查看源
- 设置淘宝源
- 切回官方镜像
3. pnpm 设置
- 查看源
- 设置淘宝源
- 切回官方镜像
4. 常见问题
npm 修改了下载源,仍然是之前的下载源。或者下载失败、下载到某处停止不动。可以进行如下操作。
- 清除缓存
- 将对应项目中的
node_modules
文件夹以及package-lock.json
文件删除。 - 执行安装 + 需要的下载源。