美文网首页
npm使用国内源

npm使用国内源

作者: jiaxiaolei | 来源:发表于2017-10-09 19:30 被阅读2447次

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

    $ npm --registry=https://registry.npm.taobao.org install

    $ cnpm install
    ⠸ [22/47] Installing stream-browserify@^2.0.1[npminstall:get] retry GET http://registry.npm.taobao.org/extglob/download/extglob-0.3.2.tgz after 100ms, retry left 4, error: ResponseError: socket hang up (req "error"), GET http://registry.npm.taobao.org/extglob/download/extglob-0.3.2.tgz -1 (connected: true, keepalive socket: true, agent status: {"createSocketCount":13,"createSocketErrorCount":0,"closeSocketCount":3,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":699,"freeSockets":{},"sockets":{"registry.npm.taobao.org:80:":10},"requests":{"registry.npm.taobao.org:80:":32}})
    headers: {}
    ⠙ [22/47] Installing requires-port@1.x.x[npminstall:get] retry GET http://registry.npm.taobao.org/util-deprecate after 100ms, retry left 4, error: ResponseError: socket hang up (req "error"), GET http://registry.npm.taobao.org/util-deprecate -1 (connected: true, keepalive socket: true, agent status: {"createSocketCount":14,"createSocketErrorCount":0,"closeSocketCount":4,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":725,"freeSockets":{},"sockets":{"registry.npm.taobao.org:80:":10},"requests":{"registry.npm.taobao.org:80:":29}})
    headers: {}
    ⠙ [44/47] Installing hoek@2.x.xplatform unsupported babel-loader@7.1.2 › webpack@2.7.0 › watchpack@1.4.0 › chokidar@1.7.0 › fsevents@^1.0.0 Package require os(darwin) not compatible with your platform(linux)
    [fsevents@^1.0.0] optional install error: Package require os(darwin) not compatible with your platform(linux)
    ✔ Installed 47 packages
    ✔ Linked 570 latest versions
    ✔ Run 0 scripts
    peerDependencies link ajv@4.11.8 in /opt/uop-frontend/node_modules/_ajv-keywords@1.5.1@ajv-keywords unmet with /opt/uop-frontend/node_modules/ajv(5.2.2)
    Recently updated (since 2017-08-22): 9 packages (detail see file /opt/uop-frontend/node_modules/.recently_updates.txt)
    ✔ All packages installed (666 packages installed from npm registry, used 1m, speed 344.94kB/s, json 617(7.53MB), tarball 20.59MB)

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Lucida Grande'; color: #3597fc}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Lucida Grande'}span.s1 {color: #000000}span.s2 {text-decoration: underline}span.s3 {text-decoration: underline ; color: #3597fc}table.t1 {border-collapse: collapse}td.td1 {border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cbcbcb #cbcbcb #cbcbcb #cbcbcb; padding: 0.0px 5.0px 0.0px 5.0px}

    $ npm --registry=https://registry.npm.taobao.org install
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN network SKIPPING OPTIONAL DEPENDENCY: getaddrinfo ENOTFOUND registry.npm.taobao.org registry.npm.taobao.org:443

    问题及解决

    问题:

    $ npm install -g cnpm --registry=https://registry.npm.taobao.org
    ....
    [               ...] / extract:moment: verb gentlyRm don't care about contents; nuking /usr/lib/node_modules/.staging/moment-846e294d/node_modules
    ...... 持续很久.......
    [               ...] / preinstall:cnpm: sill doParallel preinstall 643
    ...... 持续很久.......
    [               ...] \ build:tunnel-agent: verb linkMans tunnel-agent@0.6.0
    
    
    
    

    解决:

    重复几次,多等些时间,后来就好了。
    
    

    扩展阅读

    使用npm安装一些包失败了的看过来(npm国内镜像介绍)
    http://cnodejs.org/topic/4f9904f9407edba21468f31e
    简介:

    
    1.通过config命令
    npm config set registry https://registry.npm.taobao.org npm info underscore (如果上面配置正确这个命令会有字符串response)
    
    2.命令行指定
    npm --registry https://registry.npm.taobao.org info underscore 
    
    3.编辑~/.npmrc
    加入下面内容
    registry = https://registry.npm.taobao.org
    
    搜索镜像: [https://npm.taobao.org](https://npm.taobao.org/)
    建立或使用镜像,参考: [https://github.com/cnpm/cnpmjs.org](https://github.com/cnpm/cnpmjs.org)
    
    

    淘宝 NPM 镜像
    https://npm.taobao.org/
    简介:

    介绍了NPM镜像源的使用。
    
    $ npm install -g cnpm --registry=https://registry.npm.taobao.org
    
    $ cnpm install [name]
    
    
    

    国内优秀npm镜像推荐及使用

    http://blog.csdn.net/cengjingcanghai123/article/details/45045265

    简介:

    淘宝npm镜像

    搜索地址:http://npm.taobao.org/
    registry地址:http://registry.npm.taobao.org/

    cnpmjs镜像

    搜索地址:http://cnpmjs.org/
    registry地址:http://r.cnpmjs.org/

    https://cnpmjs.org/

    简介:

    cnpmjs.org: Private npm registry and web for Company

    So cnpm is meaning: Company npm.

    相关文章

      网友评论

          本文标题:npm使用国内源

          本文链接:https://www.haomeiwen.com/subject/oavodxtx.html