问题
I have an ionic3 application and I installed ionic with npm install -g ionic cordova
, but when I run the application with ionic serve
, i get this error :
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).
this is the 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"
}
What is the problem ? In that because I m using ionic4 to run an ionic3 application ? and haw can I fix that ?
回答1:
Please delete your node modules folder
Install latest app script from below command:
npm install @ionic/app-scripts@latest --save-dev
Now install Node modules by below command:
npm install
Try now, it will help you.
回答2:
Try running follows,
npm uninstall @ionic/app-scripts --save-dev
npm install @ionic/app-scripts@latest --save-dev
After that run ionic serve
来源:https://stackoverflow.com/questions/52802107/unable-to-run-ionic3-application