Ionic 无法解决“[错误] ng意外关闭(退出代码1)”,

332nm8kg  于 2022-12-16  发布在  Ionic
关注(0)|答案(1)|浏览(248)

我尝试为使用Angular的ionic应用程序提供服务,但一直收到此错误。我尝试删除my node_modules文件夹并重新执行npm i,但结果仍然相同。这是我收到的错误:

> ng run app:serve --host=localhost --port=8100
[ng] Node.js version v17.4.0 detected.
[ng] Odd numbered Node.js versions will not enter LTS status and should not be used for production. For more information, please see https://nodejs.org/en/about/releases/.
[ng] node:internal/modules/cjs/loader:933
[ng]   const err = new Error(message);
[ng]               ^
[ng] Error: Cannot find module 'ajv'
[ng] Require stack:
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/ajv-formats/dist/limit.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/ajv-formats/dist/index.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/schema/registry.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/schema/index.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/index.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental/jobs/index.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/index.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular/cli/src/utilities/config.js
[ng] - /Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular/cli/lib/init.js
[ng]     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[ng]     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[ng]     at Module.require (node:internal/modules/cjs/loader:999:19)
[ng]     at require (node:internal/modules/cjs/helpers:102:18)
[ng]     at Object.<anonymous> (/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/ajv-formats/dist/limit.js:4:15)
[ng]     at Module._compile (node:internal/modules/cjs/loader:1097:14)
[ng]     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
[ng]     at Module.load (node:internal/modules/cjs/loader:975:32)
[ng]     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
[ng]     at Module.require (node:internal/modules/cjs/loader:999:19) {
[ng]   code: 'MODULE_NOT_FOUND',
[ng]   requireStack: [
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/ajv-formats/dist/limit.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/ajv-formats/dist/index.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/schema/registry.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/schema/index.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/json/index.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental/jobs/simple-registry.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental/jobs/index.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/experimental.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular-devkit/core/src/index.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular/cli/src/utilities/config.js',
[ng]     '/Users/macbookair/UDACITY/cd0039-Identity-and-Access-Management/Project/03_coffee_shop_full_stack/starter_code/frontend/node_modules/@angular/cli/lib/init.js'
[ng]   ]
[ng] }
[ng] Node.js v17.4.0

[ERROR] ng has unexpectedly closed (exit code 1).

这是package.json文件的内容

{
  "name": "udaspicelatte",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^14.2.0",
    "@angular/core": "^14.2.0",
    "@angular/forms": "^14.2.0",
    "@angular/http": "^7.2.16",
    "@angular/platform-browser": "^14.2.0",
    "@angular/platform-browser-dynamic": "^14.2.0",
    "@angular/router": "^14.2.0",
    "@auth0/angular-jwt": "^5.0.2",
    "@ionic-native/core": "^5.36.0",
    "@ionic-native/splash-screen": "^5.36.0",
    "@ionic-native/status-bar": "^5.36.0",
    "@ionic/angular": "^6.2.5",
    "core-js": "^3.25.0",
    "jwt-decode": "^3.1.2",
    "lodash": "^4.17.21",
    "rxjs": "~7.5.6",
    "tslib": "^2.4.0",
    "zone.js": "~0.11.8"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.1402.1",
    "@angular-devkit/build-angular": "~14.2.1",
    "@angular-devkit/core": "~14.2.1",
    "@angular-devkit/schematics": "~14.2.1",
    "@angular/cli": "~14.2.1",
    "@angular/compiler": "~14.2.0",
    "@angular/compiler-cli": "~14.2.0",
    "@angular/language-service": "~14.2.0",
    "@ionic/angular-toolkit": "~7.0.0",
    "@types/jasmine": "~4.3.0",
    "@types/jasminewd2": "~2.0.10",
    "@types/node": "~18.7.15",
    "codelyzer": "~6.0.2",
    "jasmine-core": "~4.4.0",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "mini-css-extract-plugin": "^2.6.1",
    "protractor": "~7.0.0",
    "sass": "^1.54.9",
    "ts-node": "~10.9.1",
    "tslint": "~6.1.3",
    "typescript": "~4.8.2"
  },
  "description": "An Ionic project"
}

我已经试了好几天了

zbq4xfa0

zbq4xfa01#

错误在第3行。您需要使用其他版本的节点。

相关问题