【问题标题】:NPM Install failing with multiple error(error number 1). How to resolve?NPM 安装失败并出现多个错误(错误号 1)。如何解决?
【发布时间】:2020-02-21 20:33:20
【问题描述】:

我有一个角度项目。我有我的 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

我的 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"
  }
}

【问题讨论】:

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

标签: node.js angular npm


【解决方案1】:

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

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

    • 你可以尝试用dart-sass-loader替换node-sass
    猜你喜欢
    • 2016-11-08
    • 1970-01-01
    • 2015-06-15
    • 1970-01-01
    • 2021-07-27
    • 2018-08-27
    • 1970-01-01
    • 2017-08-28
    • 1970-01-01
    相关资源
    最近更新 更多