npm 修复漏洞后ng服务器不工作

6pp0gazn  于 2023-03-08  发布在  其他
关注(0)|答案(1)|浏览(113)

有人能帮我找出为什么我不能启动项目后,修复3高漏洞?我做了npm audit看到漏洞,然后npm install --save-dev @angular/cli@15.2.1来修复它们。现在,当我做ng serve什么也不会发生,所以我尝试npm start代替,我得到这些错误:

npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! abc@0.0.0 start: `ng serve`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the abc@0.0.0 start 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\user\AppData\Roaming\npm-cache\_logs\2023-03-07T17_32_14_773Z-debug.log

这是在日志中

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.17
3 info using node@v14.20.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle abc@0.0.0~prestart: abc@0.0.0
6 info lifecycle abc@0.0.0~start: abc@0.0.0
7 verbose lifecycle abc@0.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle abc@0.0.0~start: PATH: C:\Users\user\AppData\Roaming\nvm\v14.20.1\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\projects\abc\abc-vpn-o\management-ui\node_modules\.bin;C:\Users\user\bin;C:\Users\user\AppData\Local\Programs\Git\mingw64\bin;C:\Users\user\AppData\Local\Programs\Git\usr\local\bin;C:\Users\user\AppData\Local\Programs\Git\usr\bin;C:\Users\user\AppData\Local\Programs\Git\usr\bin;C:\Users\user\AppData\Local\Programs\Git\mingw64\bin;C:\Users\user\AppData\Local\Programs\Git\usr\bin;C:\Users\user\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\dotnet;%NVM_HOME%;%NVM_SYMLINK%;C:\Ruby31-x64\bin;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user\AppData\Local\Programs\Git\cmd;C:\Users\user\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Users\user\AppData\Local\Programs\Git\usr\bin\vendor_perl;C:\Users\user\AppData\Local\Programs\Git\usr\bin\core_perl
9 verbose lifecycle abc@0.0.0~start: CWD: C:\projects\abc\abc-vpn-o\management-ui
10 silly lifecycle abc@0.0.0~start: Args: [ '/d /s /c', 'ng serve' ]
11 silly lifecycle abc@0.0.0~start: Returned: code: 3  signal: null
12 info lifecycle abc@0.0.0~start: Failed to exec start script
13 verbose stack Error: abc@0.0.0 start: `ng serve`
13 verbose stack Exit status 3
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\user\AppData\Roaming\nvm\v14.20.1\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:400:28)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\user\AppData\Roaming\nvm\v14.20.1\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:400:28)
13 verbose stack     at maybeClose (internal/child_process.js:1088:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:296:5)
14 verbose pkgid abc@0.0.0
15 verbose cwd C:\projects\abc\abc-vpn-o\management-ui
16 verbose Windows_NT 10.0.19045
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.20.1
19 verbose npm  v6.14.17
20 error code ELIFECYCLE
21 error errno 3
22 error abc@0.0.0 start: `ng serve`
22 error Exit status 3
23 error Failed at the abc@0.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3, true ]

这是package.json的外观

{
  "name": "abc",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build-prod": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~9.0.2",
    "@angular/common": "~9.0.2",
    "@angular/compiler": "~9.0.2",
    "@angular/core": "~9.0.2",
    "@angular/forms": "~9.0.2",
    "@angular/material": "10.2.7",
    "@angular/platform-browser": "~9.0.2",
    "@angular/platform-browser-dynamic": "~9.0.2",
    "@angular/router": "~9.0.2",
    "@ngx-translate/core": "^12.1.2",
    "@ngx-translate/http-loader": "^5.0.0",
    "lodash": "^4.17.21",
    "rxjs": "~6.5.4",
    "subsink": "^1.0.1",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.1100.6",
    "@angular/cdk": "10.2.7",
    "@angular/cli": "^15.2.1",
    "@angular/compiler-cli": "~9.0.2",
    "@angular/flex-layout": "10.0.0-beta.32",
    "@angular/language-service": "~9.0.2",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/lodash": "^4.14.155",
    "@types/node": "^12.11.1",
    "ag-grid-angular": "22.1.0",
    "ag-grid-community": "22.1.0",
    "bootstrap": "^4.5.0",
    "codelyzer": "^5.1.2",
    "ini": "1.3.6",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "5.2.3",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.18.0",
    "typescript": "~3.7.5"
  }
}

我尝试删除node_modules和package-lock.json,然后删除npm install,但出现相同问题

dw1jzc5e

dw1jzc5e1#

您安装的软件包不可读。Angular必须遵循该版本的所有软件包。您安装的软件包相互干扰,并且不遵循某个版本
您可以使用此link来解决此问题首先匹配您的拷贝,然后单击npm startng serve命令

请注意,最好执行Angular的报价并更新您的项目包一份副本,一份副本

相关问题