我有一个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应用程序?我可以解决这个问题吗?
答案 0 :(得分:2)
请删除您的节点模块文件夹
从以下命令安装最新的应用程序脚本:
npm install @ ionic / app-scripts @ latest --save-dev
现在通过以下命令安装Node模块:
npm安装
立即尝试,它将为您提供帮助。
答案 1 :(得分:0)
尝试运行,
npm uninstall @ionic/app-scripts --save-dev
npm install @ionic/app-scripts@latest --save-dev
之后运行ionic serve