Ionic 3 Ionic command not found in macos - ionic-framework

I am facing issue with ionic 3. I downgrade to ionic 3 from 4. And now its showing error of ionic command not found. I try with stackovrflows answers but nothing is working.
Node -v is working only its 8.11.3
I am installing ionic#4.2.1 & cordova 8.0.0 Its installing but commands of ionic isnt working

Related

Ionic 4: Issue building for device

Error when building for the device
I am getting an error when I try to build for the device(ionic cordova run android --device). For some reason it is not creating platforms/android/app/build/outputs/apk/debug/app-debug/apk. I have tried removing and adding android different versions. Also, I have tried ionic cordova run android --no-native-run and it loads but with a blank screen.
I found 2 solutions, so if you have a problem with running the device feature:
Update CLI!
Remove Android
ionic cordova platform rm android
Add android#6 and run ionic cordova run android --no-native-run
OR
3.add the latest android#latest and run ionic cordova run android.
Those two worked for me, depending on the version of your projects!

Adding Cordova to ionic 4 failing

I have been trying to add Cordova to ionic 4 projects but i keep getting an error and I know prior now i was able to add the same but not anymore.
Whenever i run the below command its exiting with error code 1
ionic cordova plugin add cordova-plugin-x-socialsharing
I don't actually know what i am doing wrong or Cordova is no longer working
I have asked in the ionic forum but no response yet
https://forum.ionicframework.com/t/not-able-to-add-cordova-to-ionic-4/177323

Ionic v4: "Ionic cordova run -l" won't start my app

Additional notes for upcoming viewers
This seems to be a common problem on macOS: https://github.com/ios-control/ios-sim/issues/253
Temporary solution below this question.
I've worked on a fresh ionic project a few days ago and I had no problems back then whatsoever.
Today I tried to start the development server: ionic cordova run -l but then I got this error message:
No target specified for emulator. Deploying to undefined simulator
Device type "com.apple.CoreSimulator.SimDeviceType.undefined" could not be found.
An error occurred while running subprocess cordova.
Logging currently available devices(ionic cordova run --list) gives me this output:
Available ios devices:
Available ios virtual devices:
It is empty. None devices are available. Not for ios and neither for android.
Ionic version: 4.12.0
Cordova version: 9.0.0
Nodejs version: 11.5.0
I would appreciate any help to make this work again.
Seems like you have upgraded the Mac OS, faced similar problem in past and updating and re-installing iOS-sim was not of much help.
For me following command worked without installing anything further
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2"
Also, you can try this one if above don't work
ionic cordova emulate ios --livereload --consolelogs --target="iPhone-6,com.apple.CoreSimulator.SimRuntime.iOS-12-2" --buildFlag="-UseModernBuildSystem=0"
Do the following:
cd platforms/ios/cordova && npm install ios-sim#latest
cd ../../../
cordova platform rm ios
cordova platform add ios#4.5.0
ionic cordova emulate ios --target --list
ionic cordova plugin rm cordova-plugin-console
That should do it.

Fail to build android Ionic version 1

I have an Ionic version 1 project and install Ionic version 4 on my linux machine.
When trying to build an Android using ionic build android e get this error message:
Unable to load PlatformApi from platform. Error: Cannot find module '/home/myuser/ionic/myapp/platforms/android/cordova/Api.js'
How can i solve this problem?
this issue in latest ionic and cordova versions. try to Run following steps
ionic cordova platform rm browser/android/ios
ionic cordova run --emulator

Ionic platforms update returns an error

I just update to ionic beta usin the command lin npm install -g ionic#beta
whenever i run ionic platforms update ios/android
I got this error:
[ERROR] Unknown plugin: #ionic/cli-plugin-.
If you run ionic info what version of the ionic CLI are you running it looks like you have updated to V3.
If so then you need to update your command to be:
ionic cordova:platform update android
More info about CLI changes here - https://github.com/driftyco/ionic-cli/blob/v3/docs/cordova-platform.md