ng更新错误:在Object._errnoException(util.js:992:11)上连接ECONNREFUSED 104.16.21.35:80

时间:2018-10-01 19:57:43

标签: javascript json angular angular5 angular6

  • 我正在尝试将角度5从角度更新为角度6。
  • 因此,我正在执行以下步骤。 Want to upgrade project from Angular v5 to Angular v6
  • 当我执行此命令ng update @ angular / cli和ng update @ angular / core时,我遇到以下错误。
  • 你能告诉我如何解决它吗?
  • 在下面提供我的package.json
C:\codebase\branches\project>ng update @angular/cli
Your global Angular CLI version (6.2.4) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 104.16.21.35:80
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)

C:\codebase\branches\project>ng update @angular/core
Your global Angular CLI version (6.2.4) is greater than your local
version (1.7.4). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 104.16.21.35:80
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
package.json

{
  "name": "project",
  "version": "1.0.0",
  "description": "project ",
  "author": "GEOIS project team ",
  "scripts": {
    "ng": "ng",
    "rimraf": "rimraf",
    "wintersmith": "wintersmith",
    "changelog": "standard-changelog",
    "start": "ng serve",
    "start:hmr": "ng serve --hmr",
    "start:aot": "ng serve --aot",
    "start:prod": "ng serve --prod",
    "start:prod:aot": "ng serve --prod --aot",
    "build": "npm run clean:dist && ng build",
    "build:prod": "npm run build -- --prod",
    "build:prod:aot": "npm run build:prod -- --aot",
    "build:ci": "npm run build:prod && npm run build:prod:aot",
    "build:L1": "npm run build:prod:aot -- --base-href \"/project/\"",
    "build:L3": "npm run build:prod:aot -- --base-href \"/L3/project/\"",
    "build:L4": "npm run build:prod:aot -- --base-href \"/L4/project/\"",
    "build:production": "npm run build:prod:aot -- --base-href \"/project/\"",
    "test": "ng test -sr",
    "test:coverage": "npm run clean:coverage && ng test -sr -cc",
    "lint": "ng lint",
    "lint:styles": "stylelint ./src/app/**/*.scss",
    "lint:ci": "npm run lint && npm run lint:styles",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "ng e2e",
    "clean": "npm cache clean && npm run rimraf -- node_modules doc typings coverage dist",
    "clean:dist": "npm run rimraf -- dist",
    "clean:coverage": "npm run rimraf -- coverage",
    "docs:build": "wintersmith build -C docs -o build/project",
    "docs:deploy": "npm run docs:build && gh-pages -d docs/build -r git@github.com:akveo/akveo.github.io.git -b master",
    "docs:serve": "wintersmith preview -C docs"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "5.2.0",
    "@angular/common": "5.2.0",
    "@angular/compiler": "5.2.0",
    "@angular/core": "5.2.0",
    "@angular/forms": "5.2.0",
    "@angular/http": "5.2.0",
    "@angular/platform-browser": "5.2.0",
    "@angular/platform-browser-dynamic": "5.2.0",
    "@angular/platform-server": "5.2.0",
    "@angular/router": "5.2.0",
    "@ng-select/ng-select": "^1.3.0",
    "@ngx-translate/core": "^10.0.2",
    "@ngx-translate/http-loader": "^3.0.1",
    "@swimlane/ngx-charts": "^8.0.2",
    "animate.css": "3.5.2",
    "bootstrap": "^3.3.7",
    "bootstrap-sass": "^3.3.7",
    "chart.js": "^2.7.2",
    "chroma-js": "1.3.3",
    "core-js": "2.4.1",
    "d3": "^5.4.0",
    "enhanced-resolve": "^3.3.0",
    "font-awesome": "4.7.0",
    "ionicons": "2.0.1",
    "jquery": "3.2.1",
    "jquery-slimscroll": "1.3.8",
    "lodash": "4.17.4",
    "moment": "^2.14.1",
    "ng2-completer": "1.3.1",
    "ng2-datetime": "^1.4.0",
    "ng2-select-compat": "^1.3.1",
    "ng2-slim-loading-bar": "4.0.0",
    "ng2-smart-table": "1.0.3",
    "ng2-toastr": "^4.1.2",
    "ngx-bootstrap": "^2.0.5",
    "node-sass": "^4.9.3",
    "normalize.css": "6.0.0",
    "roboto-fontface": "0.7.0",
    "rxjs": "^5.5.6",
    "tether": "^1.4.4",
    "zone.js": "0.8.11"
  },
  "devDependencies": {
    "@angular/cli": "^1.7.4",
    "@angular/compiler-cli": "5.2.0",
    "@types/fullcalendar": "2.7.40",
    "@types/jasmine": "2.5.38",
    "@types/jquery": "2.0.41",
    "@types/jquery.slimscroll": "1.3.30",
    "@types/lodash": "4.14.61",
    "@types/node": "6.0.69",
    "codelyzer": "3.0.1",
    "css-loader": "^0.28.11",
    "gh-pages": "0.12.0",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "3.2.0",
    "karma": "1.4.1",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage-istanbul-reporter": "0.2.0",
    "karma-jasmine": "1.1.0",
    "karma-jasmine-html-reporter": "0.2.2",
    "npm-run-all": "4.0.2",
    "protractor": "5.1.0",
    "rimraf": "2.6.1",
    "standard-changelog": "1.0.1",
    "style-loader": "^0.21.0",
    "stylelint": "7.10.1",
    "ts-node": "2.1.2",
    "tslint": "5.2.0",
    "tslint-eslint-rules": "4.0.0",
    "tslint-language-service": "0.9.6",
    "typescript": "2.4.2",
    "typogr": "0.6.6",
    "underscore": "1.8.3",
    "wintersmith": "2.2.5",
    "wintersmith-sassy": "1.1.0"
  }
}


angular cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "ng2-admin"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "../node_modules/roboto-fontface/css/roboto/sass/roboto-fontface.scss",
        "../node_modules/normalize.css/normalize.css",
        "../node_modules/font-awesome/scss/font-awesome.scss",
        "../node_modules/ionicons/scss/ionicons.scss",
        "../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss",
        "app/theme/theme.scss",
        "styles.scss"
      ],
      "scripts": [
        "../node_modules/jquery/dist/jquery.js",
        "../node_modules/jquery-slimscroll/jquery.slimscroll.js",
        "../node_modules/tether/dist/js/tether.js",
        "../node_modules/bootstrap/dist/js/bootstrap.js",
        "../node_modules/chroma-js/chroma.js"
      ],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {
    }
  }
}

1 个答案:

答案 0 :(得分:0)

这通常是代理的npm问题,实际上不是CLI问题。

看看Using npm behind corporate proxy .pac

基本上,您需要确保已配置npm以通过代理工作,然后ng cli应该不会出现连接问题。

npm config set proxy "http://domain\username:password@servername:port/"

请注意,这会将您的密码保存在配置文件中,因此完成后,您可能希望像这样删除已保存的密码”

npm config delete proxy