美文网首页
升级node.js

升级node.js

作者: sunny_轻芒 | 来源:发表于2017-06-24 16:43 被阅读37次

    这几天工作的需要,要研究下webpack,看到官网上说:

    Pre-requisites
    Before we begin, make sure you have a fresh version of [Node.js]
    (https://nodejs.org/en/) installed. The current Long Term Support (LTS)
    release is an ideal starting point. You may run into a variety of issues with
    the older versions as they may be missing functionality webpack and/or its
    related packages require.

    于是乎就去屁颠屁颠地去升级电脑中的node.js,结果蛋疼的公司代理又一次阻止了一次伟大的....(此处省略),反复设置代理又删除代理还是不行,报了如下错误,mac环境:

    tunneling socket could not be established, cause=connect ETIMEDOUT
    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad 
    network settings.
    

    折腾了好久,回到家里心想躲过了万恶的公司代理应该没问题了,结果结果,是我错怪它了,接着到网上搜索了下相关信息,感谢stackoverflow上的答案:

    Removing the proxy settings resolved the issue:

    npm config rm proxy
    npm config rm https-proxy

    可能是之前删除代理的姿势不对,之前执行的是这个

    npm config delete proxy
    
    

    这个我也搞不清楚为啥不行。

    啰嗦这么久,送上升级node.js版本的方法:

    1.安装n模块
    npm install -g n
    
    2.升级到最新稳定版
    n stable
    
    3.也可以用n命令升级到其他版本,尽情挖掘其他功能
    

    升级成功,后面不知道还会有什么更大的麻烦,就酱。

     linzhch:~ linzhch$ n stable
     install : node-v8.0.0
     mkdir : /usr/local/n/versions/node/8.0.0
     fetch : https://nodejs.org/dist/v8.0.0/node-v8.0.0-darwin-x64.tar.gz
    ######################################################################## 100.0%
       installed : v8.0.0
    

    相关文章

      网友评论

          本文标题:升级node.js

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