开发者问题收集

无法运行 ionic3 应用程序

2018-10-14
3242

我有一个 ionic3 应用程序,并且我使用 npm install -g ionic cordova 安装了 ionic,但是当我使用 ionic serve 运行该应用程序时,出现此错误:

typescript error

[app-scripts]             Unknown compiler option 'resolveJsonModule'.

[app-scripts]             Unknown compiler option 'esModuleInterop'.

[app-scripts] [11:58:10]  typescript error
[app-scripts] [11:58:10]  ionic-app-script task: "serve"
[app-scripts] [11:58:10]  TypeError: Cannot read property 'replace' of null
[app-scripts] TypeError: Cannot read property 'replace' of null
[app-scripts]     at Object.escapeHtml 

 [ERROR] ionic-app-scripts has unexpectedly closed (exit code 1).

这是 package.json

   "scripts": {
   "start": "ionic-app-scripts serve",
   "clean": "ionic-app-scripts clean",
  "build": "ionic-app-scripts build",
   "lint": "ionic-app-scripts lint"
  }
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
   "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/core": "~4.9.2",
   "@ionic-native/local-notifications": "^4.11.0",
   "@ionic-native/native-storage": "^4.10.0",
   "@ionic-native/splash-screen": "~4.9.2",
   "@ionic-native/status-bar": "~4.9.2",
   "@ionic/core": "^4.0.0-beta.12",
    "@ionic/pro": "1.0.20",
   "@ionic/storage": "2.1.3",
    "angular": "^1.7.5",
    "chart.js": "^2.7.2",
   "cordova-android": "7.0.0",
    "cordova-browser": "^5.0.4",
    "cordova-ios": "4.5.5",
   "cordova-plugin-device": "^2.0.2",
  "cordova-plugin-ionic-keyboard": "^2.0.5",
   "cordova-plugin-ionic-webview": "^1.1.19",
   "cordova-plugin-local-notification": "^0.9.0-beta.2",
    "cordova-plugin-splashscreen": "^5.0.2",
   "cordova-plugin-whitelist": "^1.3.3",
    "crypto-js": "^3.1.9-1",
   "ionic": "^4.2.1",
    "ionic-angular": "3.9.2",
   "ionicons": "3.0.0",
   "rxjs": "5.5.11",
   "sw-toolbox": "3.6.0",
   "zone.js": "0.8.26"
  },
 "devDependencies": {
    "@ionic/app-scripts": "3.1.11",
    "typescript": "~2.6.2"
  }

问题是什么? 因为我使用 ionic4 来运行 ionic3 应用程序? 我该如何修复它?

2个回答

请删除您的节点模块文件夹

通过以下命令安装最新的应用脚本:

npm install @ionic/app-scripts@latest --save-dev

现在通过以下命令安装节点模块:

npm install

立即尝试,它会对您有所帮助。

Raj
2018-12-17

尝试运行以下命令,

npm uninstall @ionic/app-scripts --save-dev

npm install @ionic/app-scripts@latest --save-dev

之后运行 ionic serve

Sudarshana Dayananda
2018-10-14