nodejs 国内镜像源

青苗 青苗 | 555 | 2022-11-03

推荐使用阿里的镜像源

通过 config 命令配置

  • 通过全局配置指定镜像源:

npm config set registry https://registry.npmmirror.com

  • 在安装模块的时候指定镜像源

使用npmmirror镜像源 安装 loaddash 模块

npm install loaddash --registry https://registry.npmmirror.com

  • 编辑~/.npmrc加入下面内容
    还可以通过配置文件指定全局配置镜像源

registry=https://registry.npmmirror.com

  • 使用 cnpm 如果你不想修改镜像源,每次安装过程时指定镜像源又嫌麻烦的话,可以安装 cnpm 这个模块,这样在之后安装模块的时候使用 cnpm命令代替 npm命令,同样能使用该镜像源。

npm install -g cnpm --registry=https://registry.npmmirror.com

  • 参考资料

https://npmmirror.com/
淘宝 NPM 镜像站

文章标签: JavaScript
推荐指数:

真诚点赞 诚不我欺~

nodejs 国内镜像源

点赞 收藏 评论

关于作者

青苗
青苗

青苗幼儿园园长

等级 LV5

粉丝 20

获赞 47

经验 1182