npm 无法安装时,国内被墙的解决方法
npm无法安装时,国内被墙的解决方法。
你可以使用我们定制的cnpm(gzip压缩支持)命令行工具代替默认的npm
:$npminstall-gcnpm--registry=https://registry.npm.taobao.org
或者你直接通过添加npm
参数alias
一个新命令:
aliascnpm="npm--registry=https://registry.npm.taobao.org\
--cache=$HOME/.npm/.cache/cnpm\
--disturl=https://npm.taobao.org/dist\
--userconfig=$HOME/.cnpmrc"
#Oraliasitin.bashrcor.zshrc
$echo'\n#aliasforcnpm\naliascnpm="npm--registry=https://registry.npm.taobao.org\
--cache=$HOME/.npm/.cache/cnpm\
--disturl=https://npm.taobao.org/dist\
--userconfig=$HOME/.cnpmrc"'>>~/.zshrc&&source~/.zshrc安装模块
从registry.npm.taobao.org安装所有模块.当安装的时候发现安装的模块还没有同步过来,淘宝NPM会自动在后台进行同步,并且会让你从官方NPMregistry.npmjs.org进行安装.下次你再安装这个模块的时候,就会直接从淘宝NPM安装了.
$cnpminstall[name]同步模块
直接通过sync
命令马上同步一个模块,只有cnpm
命令行才有此功能:
$cnpmsyncconnect
当然,你可以直接通过web方式来同步:/sync/connect
$openhttps://npm.taobao.org/sync/connect其它命令
支持npm
除了publish
之外的所有命令,如:
$cnpminfoconnect
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。