search

Home  >  Q&A  >  body text

node.js - vue-cli 创建项目的时候出现connect ECONNREFUSED 错误,请问如何解决?

我在用vue.js的vue-cli工具创建项目的时候出现了connect ECONNREFUSED 192.30.252.137:443 这个问题。

用的淘宝镜像

PS F:\myWeb\1guanggao\qixi2016> vue init webpack

? Generate project in current directory? Yes
   vue-cli · connect ECONNREFUSED 192.30.252.137:443
connect ETIMEDOUT 192.30.252.137:443

现在出现这个问题,尝试ping这个地址,结果一直超时

各位知道什么原因导致的,怎么解决吗?

黄舟黄舟2784 days ago881

reply all(7)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 15:25:48

    I went and finally solved it after struggling for so long~~~~

    I wonder if your host file has been modified?

    Because I changed the host to circumvent the wall, and then used lantern to circumvent the wall. Today I accidentally saw someone saying that it is enough to delete the host-related configuration for bypassing the firewall. I deleted the configuration related to github and it really worked. . . If your host has been modified, you can give it a try!

    I don’t know the reason, but I guess it is possible that the host file configuration conflicts with the proxy software configuration?

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:25:48

    Ask this question

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 15:25:48

    Written on mobile phone, vue init webpack project-name

    reply
    0
  • PHPz

    PHPz2017-04-17 15:25:48

    Has the questioner solved this problem? I have the same problem and don’t know how to solve it...

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 15:25:48

    To put it simply, the reason is a proxy setting issue.

    Specifically, in vue-cli, use request to query the list of downloadable templates and use download-git-repo to download the corresponding template.

    request Module

    request does not have a proxy set. You can modify the places where vue-init is used in the vue-list and request files and add the corresponding proxy server settings, such as the vue-init method in checkDistBranch:

    function checkDistBranch (template, cb) {
      request({
        proxy: "Your proxy address",
        url: 'https://api.github.com/repos/' + template + '/branches',
        headers: {
          'User-Agent': 'vue-cli'
        }
      }, function (err, res, body) {
        if (err) logger.fatal(err)
        if (res.statusCode !== 200) {
          logger.fatal('Template does not exist: ' + template)
        } else {
          var hasDist = JSON.parse(body).some(function (branch) {
            return branch.name === 'dist'
          })
          return cb(hasDist ? template + '#dist' : template)
        }
      })
    }

    This ensures that vue-cli can query the corresponding downloadable template list.

    download-git-repo Module

    The

    download module uses download-git-repo, which depends on the download module. The download module uses the caw module, which can read the proxy we set in .npmrc, so when it is set .npmrc There will be no problem in the process of downloading the template.

    Solution

    If your network environment requires setting up a proxy server to access the external network, then you need:

    • Modify the calling method of request and add the proxy attribute.

    • Set up your .npmrc file and configure the corresponding proxy server.

    To be simpler, you can also directly download the corresponding template, such as webpack-simple and place it in the same level directory where vue init needs to be executed, so that vue init can run successfully.

    Friendly reminder

    Note that the webpack-simple template uses the vue 2.0 version. If you want to develop based on the 1.x version, please use the vue init webpack-simple#1.0 my-project command to specify the template branch.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:25:48

    I also encountered the same problem before. After searching for a while, I found that it should be a host problem. I changed my hosts before and restored it to the default state.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 15:25:48

    Yesterday was good. . After updating to vue-cli version 2.5, I have the same problem as the original po~! ~! ! Ahhhhhhhhhhhhhhhhhhhhhhhh~! ! I don't understand. Find the solution~!

    reply
    0
  • Cancelreply