Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用淘宝NPM镜像 #20

Closed
nimojs opened this issue Apr 19, 2015 · 10 comments

Comments

Projects
None yet
8 participants
@nimojs
Copy link
Member

commented Apr 19, 2015

使用淘宝NPM镜像

本文是 《Gulp 入门指南》 - 安装 Node 和 gulp 的附属教程

在使用 node 模块时可以使用 npm install 查找 package.json 中的声明的依赖模块并安装。

但因为国内网络原因,使用 npm 安装某些模块会非常慢。

例如 gulp-demo 依赖了十多个模块,使用 npm install 时经常因为网络原因无法安装所有的包。


好在淘宝提供了 npm 镜像供我们使用。

安装 cnpm

在命令行输入:

npm install -g cnpm --registry=https://registry.npm.taobao.org

使用 cnpm 安装模块

cnpm install [name]

这真的是个大坑,有时候一个 基于 gulp 的自动化开发环境的依赖包文件会有几十MB。使用 npm 安装很久也不一定能安装完成。

相关链接:

点此订阅博客

若作者显示不是Nimo(被转载了),请访问Github原文进行讨论:#20

@huanmie913

This comment has been minimized.

Copy link

commented May 12, 2015

感谢楼主无私分享

@leo-lai

This comment has been minimized.

Copy link

commented Aug 2, 2015

cnpm install -g [name] 全局安装是用这个么?

@nimojs

This comment has been minimized.

Copy link
Member Author

commented Aug 3, 2015

@leo-lai 是的 cnpm 命令基本与 npm 一致。但没有 publish 功能。

@leo-lai

This comment has been minimized.

Copy link

commented Aug 3, 2015

@nimojs 知道了,非常感谢您的回复

@nimojs nimojs closed this Dec 25, 2015

@Haojen

This comment has been minimized.

Copy link

commented Mar 15, 2016

感谢,用 gulp 的时候 npm 原生太慢

@jiajunlin

This comment has been minimized.

Copy link

commented May 9, 2016

感谢楼主分享。学习了

@Aisuko

This comment has been minimized.

Copy link

commented Sep 25, 2016

感谢楼主无私分享,Get

@Kevin-Gallagher

This comment has been minimized.

Copy link

commented Apr 25, 2017

为什么我照你说的方法安装了,命令行输入gulp -v还是说“gulp”不是外部或内部命令,也不是可运行的程序或批处理文件?

@nimojs

This comment has been minimized.

Copy link
Member Author

commented Apr 26, 2017

@Kevin-Gallagher
试试在C盘运行,然后是通过 npm install -g gulp 安装的吗

@happyyangyuan

This comment has been minimized.

Copy link

commented Feb 5, 2018

虽然设置了taobao的registry地址,但是中间还有一步依然是从amazon服务器上下载资源,这步是 node-pre-gyp http GET https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.2-node-v48-linux-x64.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.