_From @Zerokk on May 15, 2017 8:19_
Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x ] 3.x
I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
I was using the Ionic 3 beta CLI, and tried to install the ConnectivityService. It couldn't work in that version, so I performed a clean uninstall of ionic, and then, a new install aiming to ionic@latest. It gave a dependency error on app-scripts, so I used the following command:
npm install --save @ionic/app-scripts@^1.3.1
Then, I used again "npm install -g ionic@latest". After that, everything stopped working. I can't do anything with ionic anymore; I just keep having the same error with whatever I do: "TypeErrpr: Cannot read property 'includes' of undefined". It doesn't matter if I uninstall it and install it again; I just can't get it working.
Expected behavior:
The new version should have been properly installed and the provider, too.
Steps to reproduce:
(already told)
Any help regarding this? My project is stopped from this point and I can't get to test anything.
_Copied from original issue: driftyco/ionic#11667_
@Zerokk We need your current ionic info output and content of packages.json.
Hi @piotrowski, here you have all the package.json contents. "ionic info" won't send any other message than the TypeError bug I'm begging help for...
{
"name": "myApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@ionic-native/core": "3.4.2",
"@ionic-native/splash-screen": "^3.5.0",
"@ionic-native/status-bar": "3.4.2",
"@ionic/app-scripts": "^1.3.1",
"@ionic/storage": "2.0.1",
"cordova-plugin-whitelist": "^1.3.1",
"image-manipulation": "0.0.4",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"parse": "^1.9.2",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "^1.3.1",
"typescript": "~2.2.1",
"@ionic/cli-plugin-cordova": "0.0.12",
"@ionic/cli-plugin-ionic-angular": "0.0.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {}
}
}
}
Hmm, does it really say this:
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
"": "4.0.0",
Empty strings in "?
Please give us the output of this command:
npm list -g --depth=0
The package.json got wrong when pasting, idk why. Here you have the good one:
{
"name": "StepApp",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@ionic-native/core": "3.4.2",
"@ionic-native/splash-screen": "^3.5.0",
"@ionic-native/status-bar": "3.4.2",
"@ionic/app-scripts": "^1.3.1",
"@ionic/storage": "2.0.1",
"cordova-plugin-whitelist": "^1.3.1",
"image-manipulation": "0.0.4",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"parse": "^1.9.2",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "^1.3.1",
"typescript": "~2.2.1",
"@ionic/cli-plugin-cordova": "0.0.12",
"@ionic/cli-plugin-ionic-angular": "0.0.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {}
}
}
}
Here you have the npm listing:
C:\Users\Zerok\AppData\Roamingnpm
+-- [email protected]
+-- [email protected]
`-- [email protected]
Ok.
package.json shows you using some pretty old stuff. You should definitely take care of @ionic/app-scripts and the both @ionic-cli-plugins. But first your have to fix the bad stuff:
@ionic/app-scripts should not be a dependency but a devDependency, delete that line.npm uninstall -g ionic. Make sure it is actually gone with npm list -g --depth=0npm install -g ionic - that should be enough.nvm - much cleaner and easier to keep working@piotrowski Which lines should I delete from package.json before performing the reinstall? By the way, my node version is 7.9.
Thank you this far! :)
Delete this one: "@ionic/app-scripts": "^1.3.1", in dependencies.
I keep getting the same error after performing all of this...
Here is the output when I use the --verbose option:
[DEBUG] Checking for latest plugin version of ionic@latest.
"3.0.0"[DEBUG] Latest version of ionic@latest is .
[DEBUG] !!! ERROR ENCOUNTERED !!!
SyntaxError: Unexpected end of JSON input
[DEBUG] SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at C:\Users\Zerok\AppData\Roamingnpmnode_modules\ionicnode_modules\@ionic\cli-utils\dist\lib\plugins.js:212:36
at Generator.next ()
at fulfilled (C:\Users\Zerok\AppData\Roamingnpmnode_modules\ionicnode_modules\@ionic\cli-utils\dist\lib\plugins.js:4:58)
What command gives you this output?
Maybe fix for this:
npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest
npm install --save-dev --save-exact @ionic/cli-plugin-cordova@latest
Maybe also check this:
https://github.com/driftyco/ionic-cli/issues/2275
Thank you @piotrowski, you just fixed it! Installing those libraries just fixed my problem.
Many thanks!
Most helpful comment
What command gives you this output?
Maybe fix for this: