NPM安装失败,出现多个错误(错误编号1)。怎么解决?

时间:2019-10-25 13:21:10

标签: node.js angular npm

我有一个棱角分明的项目。我有package.json文件。我正在尝试安装npm。但是它失败并出现错误。

  • 节点版本-12.13.0
  • 角度cli-7.2.4
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1321:34)

gyp ERR! stack     at TLSSocket.emit (events.js:210:5)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:794:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:608:12)
gyp ERR! System Windows_NT 10.0.16299

gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\GTHIE\\KPMG.Tax.Hub.IE.Angular\\gam-client-solution\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="

gyp ERR! cwd C:\GTHIE\KPMG.Tax.Hub.IE.Angular\gam-client-solution\node_modules\node-sass

gyp ERR! node -v v12.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Build failed with error code: 1

.....
.....

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.10.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.10.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\spandab\AppData\Roaming\npm-cache\_logs\2019-10-24T15_08_10_658Z-debug.log

MY package.json文件为:

{
  "name": "my-solution",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "@ant-design/icons-angular": "^8.1.1",
    "@ng-idle/core": "~6.0.0-beta.3",
    "@ng-idle/keepalive": "~6.0.0-beta.3",
    "bootstrap": "~3.3.7",
    "core-js": "^2.5.4",
    "date-fns": "~1.29.0",
    "devextreme": "~19.1.3",
    "devextreme-angular": "~19.1.3",
    "file-saver": "~1.3.8",
    "flag-icon-css": "~3.0.0",
    "less": "~2.7.3",
    "ng-zorro-antd": "^1.3.0",
    "rxjs": "~6.3.3",
    "stream": "0.0.2",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.12.0",
    "@angular-devkit/build-ng-packagr": "~0.12.0",
    "@angular/cli": "~7.2.1",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.1.1",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "ng-packagr": "^4.2.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tsickle": ">=0.34.0",
    "tslib": "^1.9.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

2 个答案:

答案 0 :(得分:0)

如果您有代理,请尝试以下两个命令:

npm config set strict-ssl false
npm config set registry http://registry.npmjs.org/ --global

答案 1 :(得分:0)

我通过卸载节点并安装旧版本8来解决。