简体   繁体   中英

Ng serve is working but ionic serve is failing

I'm building an app using Ionic 6.19.0 and it suddenly started to face building issues. I get Error: spawn UNKNOWN each time I execute ionic serve.

This is my package.json file

{
  "name": "stile",
  "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-devkit/schematics": "^13.3.3",
    "@angular/common": "~13.0.0",
    "@angular/core": "~13.0.0",
    "@angular/forms": "~13.0.0",
    "@angular/platform-browser": "~13.0.0",
    "@angular/platform-browser-dynamic": "~13.0.0",
    "@angular/router": "~13.0.0",
    "@auth0/angular-jwt": "^5.0.2",
    "@capacitor/android": "3.4.3",
    "@capacitor/app": "1.1.0",
    "@capacitor/camera": "^1.3.1",
    "@capacitor/core": "3.4.0",
    "@capacitor/haptics": "1.1.4",
    "@capacitor/keyboard": "1.2.1",
    "@capacitor/status-bar": "1.0.7",
    "@ionic/angular": "^6.0.0",
    "@npmcli/node-gyp": "^2.0.0",
    "bootstrap": "^5.1.3",
    "install": "^0.13.0",
    "jquery": "^3.6.0",
    "json-server": "^0.17.0",
    "node-sass": "^7.0.1",
    "npm": "^8.6.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.3.1",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.3.3",
    "@angular-eslint/builder": "^12.2.1",
    "@angular-eslint/eslint-plugin": "~13.0.1",
    "@angular-eslint/eslint-plugin-template": "~13.0.1",
    "@angular-eslint/template-parser": "~13.0.1",
    "@angular/cli": "~13.0.1",
    "@angular/compiler": "~13.0.0",
    "@angular/compiler-cli": "~13.0.0",
    "@angular/language-service": "~13.0.0",
    "@capacitor/cli": "3.4.0",
    "@ionic/angular-toolkit": "^6.1.0",
    "@popperjs/core": "^2.11.5",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "acorn": "^8.7.0",
    "ajv": "^6.12.6",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.4.4"
  },
  "description": "An Ionic project"
}

Here are few solutions that might help:

  1. Ensure you're in the root folder of your project.
  2. Try fixing the existing node_modules folder with npm rebuild + reassign permissions to your node_modules folder: chmod 755 -R /path/to/node_modules
  3. Remove node_modules and reinstall with npm install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM