By mistake updated from ionic 3 to ionic 4 and now unable to go back to the ionic 3


#1

Whenever we run the ionic app, it prompts to update the ionic version. And I, by mistake updated the version and after that I am unable to run the project. What I want is to go back to the ionic 3 but what error I am getting now is attached as screenshot and also copied below:

“”" ? Looks like this is an Ionic Angular project, would you like to install @ionic/cli-plugin-ionic-angular and continue? No
? The Ionic CLI has an update available (3.2.0 => 4.3.0)! Would you like to install it? No
[OK] Not automatically updating your CLI. You can update manually:

 npm install -g ionic@latest

[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date.
TypeError: env.runcmd is not a function “”"

Some one please help me to go back to ionic 3 safely… thanks


#2
npm install -g ionic@3.2.0

If it does not work, uninstall Ionic and clean the npm cache, then install 3.2.0 again.


#3

What version do you get when you run ionic -v?

From what I see, that plugin was deprecated in Ionic CLI 3.8:

It was this plugin that you received an error?

In newer versions of the plugin you can just remove it from your project.

Have in mind that ionic in that case is related to the cli, not the framework. This can cause some confusion. In your case, you should be able to use the ionic cli@4+, even if your project is v3, just like in my case).

In any case, you can try to remove @ionic/cli-plugin-cordova from your project, and uninstall and install again the ionic cli:

In your project folder:

npm uninstall @ionic/cli-plugin-cordova
npm uninstall -g ionic
npm install -g ionic@latest

If this doesn’t work you may try the older version:

npm install @ionic/cli-plugin-cordova
npm uninstall -g ionic
npm install -g ionic@3.2.0

What is your npm and node versions (you can run ionic info and paste the output here)


#4

@elvis_gn

Yes, I did it and still problem exist. Please refer the following image:


#5

@lucasbasquerotto

node: v8.9.4
npm: 5.6.0


#6

@pantarmj Have you tried the 2 approaches I explained previously? One with the latest version, the other with the older?

What is in your package.json?


#7

I did a complete uninstall and reinstall using the following link

Following the first 3 commands…node and npm reinstall should not be required.


#8

@lucasbasquerotto

when I tried to go to ionic 3.2.0 by following your steps, I got the following:

and when updated to ionic@latest and then run the program, got the following:


#9

@lucasbasquerotto

This is my package.json:

“private”: true,
“scripts”: {
“clean”: “ionic-app-scripts clean”,
“build”: “ionic-app-scripts build”,
“lint”: “ionic-app-scripts lint”,
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”,
“browser”: “ionic-app-scripts serve --sourceMap source-map --iscordovaserve --wwwDir platforms/browser/www/ --buildDir platforms/browser/www/build”
},
“dependencies”: {
@angular-devkit/build-optimizer”: “^0.5.x”,
@angular/common”: “^5.x.x”,
@angular/compiler”: “^5.x.x”,
@angular/compiler-cli”: “^5.x.x”,
@angular/core”: “^5.x.x”,
@angular/forms”: “^5.x.x”,
@angular/http”: “^5.x.x”,
@angular/platform-browser”: “^5.x.x”,
@angular/platform-browser-dynamic”: “^5.x.x”,
@ionic-native/app-version”: “^4.6.0”,
@ionic-native/barcode-scanner”: “^4.6.0”,
@ionic-native/camera”: “^4.6.0”,
@ionic-native/core”: “^4.6.0”,
@ionic-native/device”: “^4.6.0”,
@ionic-native/diagnostic”: “^4.15.0”,
@ionic-native/document-viewer”: “^4.7.0”,
@ionic-native/file”: “^4.6.0”,
@ionic-native/file-transfer”: “^4.6.0”,
@ionic-native/image-picker”: “^4.7.0”,
@ionic-native/in-app-browser”: “^4.6.0”,
@ionic-native/network”: “^4.6.0”,
@ionic-native/onesignal”: “^4.6.0”,
@ionic-native/splash-screen”: “^4.x.x”,
@ionic-native/status-bar”: “^4.x.x”,
@ionic-native/toast”: “^4.6.0”,
@ionic/storage”: “2.2.0”,
“browse”: “0.4.0”,
“cordova”: “^8.1.2”,
“cordova-android”: “6.4.0”,
“cordova-browser”: “5.0.4”,
“cordova-ios”: “4.5.5”,
“cordova-plugin-app-version”: “^0.1.9”,
“cordova-plugin-camera”: “^4.0.3”,
“cordova-plugin-device”: “^2.0.2”,
“cordova-plugin-document-viewer”: “^0.9.10”,
“cordova-plugin-file”: “^6.0.1”,
“cordova-plugin-file-transfer”: “^1.7.1”,
“cordova-plugin-ignore-lint-translation”: “0.0.1”,
“cordova-plugin-image-picker”: “^1.1.3”,
“cordova-plugin-inappbrowser”: “^3.0.0”,
“cordova-plugin-ionic-webview”: “^2.1.4”,
“cordova-plugin-network-information”: “^2.0.1”,
“cordova-plugin-splashscreen”: “^5.0.2”,
“cordova-plugin-statusbar”: “^2.4.2”,
“cordova-plugin-whitelist”: “^1.3.3”,
“cordova-plugin-x-toast”: “^2.7.0”,
“cordova.plugins.diagnostic”: “^4.0.10”,
“crypto-js”: “^3.1.9-1”,
“ionic-angular”: “^3.9.2”,
“ionic-img-viewer”: “^2.9.0”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“moment”: “^2.22.0”,
“moment-timezone”: “^0.5.14”,
“onesignal-cordova-plugin”: “^2.4.3”,
“phonegap-plugin-barcodescanner”: “^8.0.0”,
“rxjs”: “^5.x.x”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “^0.8.25”
},
“devDependencies”: {
@ionic/app-scripts”: “3.2.0”,
@types/crypto-js”: “^3.1.39”,
“typescript”: “^2.6.2”,
“webpack”: “^3.12.0”
},
“cordovaPlugins”: [
“cordova-plugin-statusbar”,
“cordova-plugin-console”,
“cordova-plugin-device”,
“cordova-plugin-splashscreen”,
“ionic-plugin-keyboard”
],
“cordovaPlatforms”: [
“ios”,
{
“platform”: “ios”,
“version”: “”,
“locator”: “ios”
}
],
“description”: “whatever”,
“config”: {
“ionic_bundler”: “webpack”,
“ionic_generate_source_map”: false,
“ionic_source_map_type”: “eval”,
“ionic_copy”: “./config/copy.config.js”
},
“cordova”: {
“plugins”: {
“ionic-plugin-keyboard”: {},
“cordova-plugin-whitelist”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-file”: {},
“cordova-plugin-file-transfer”: {},
“onesignal-cordova-plugin”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-device”: {},
“cordova-plugin-network-information”: {},
“cordova-plugin-app-version”: {},
“cordova-plugin-x-toast”: {},
“cordova-plugin-ignore-lint-translation”: {},
“cordova-plugin-camera”: {},
“cordova-plugin-document-viewer”: {},
“cordova.plugins.diagnostic”: {},
“cordova-plugin-image-picker”: {
“PHOTO_LIBRARY_USAGE_DESCRIPTION”: " "
},
“phonegap-plugin-barcodescanner”: {
“ANDROID_SUPPORT_V4_VERSION”: “27.+”
},
“cordova-plugin-ionic-webview”: {
“ANDROID_SUPPORT_ANNOTATIONS_VERSION”: “27.+”
},
“cordova-plugin-inappbrowser”: {}
},
“platforms”: [
“android”,
“ios”,
“browser”
]
}


#10

@elvis_gn I didn’t means to reinstall npm and node, but ionic and @ionic/cli-plugin-cordova. I only wanted to know the versions of node and npm.


#11

@pantarmj It seems like your browser platform is with problems. Remove it and add it again:

Use the latest ionic cli version and a brand new browser platform:

npm install -g ionic@latest
cordova platform rm browser
cordova platform add browser
ionic cordova run browser

More information in:

As a side note, the problem you had with the older version is because you need to install @ionic/cli-plugin-cordova. Remove it only with newer versions. See the commands I used in my previous post:

npm install @ionic/cli-plugin-cordova
npm uninstall -g ionic
npm install -g ionic@3.2.0

(Only use the older version if you can’t fix with newer ones)


#12

@lucasbasquerotto. A very big thanks to you dear, you helped me a lot in a very clear way. I updated the ionic to latest, uninstalled cordova, removed and added all platforms (browser, android, iOS) and now its working. But when I run “ionic cordova run ios” it shows following error:

and I solved the above error by running the run command as follows:

ionic cordova run ios – --buildFlag="-UseModernBuildSystem=0"

really really thanks dear :slight_smile:


Hammer.min.js.map : Failed to load resource: the server responded with a status of 404 (Not Found) on iOS only
#13

@lucasbasquerotto. Please help me for one more issue that I posted on forum which is unsolved and no one has replied on that. The link of that issue is given below:

please @lucasbasquerotto


#14

@lucasbasquerotto

thank you so much to reply there.


#15

Hi,
please refer this link