ionic g provider [name]
enter image description here
then I seek for help ionic g --help so it giving me these examples
Examples:
$ ionic g
$ ionic g page
$ ionic g page contact
$ ionic g component contact/form
$ ionic g component login-form --change-detection=OnPush
$ ionic g directive ripple --skip-import
$ ionic g service api/user
According to official documentation of ionic v3 and v4 for generate cli you have to use the below commands to generate a service/provider for respective version.
Ionic v3
ionic generate provider [service/provider name]
ionic g provider [service/provider name]
Ionic V4
ionic generate service [service/provider name]
ionic g service [service/provider name]
Related
Hello dear community currently I work on my portfolio but with the version 4 of ionic I manage not to generate a new page by typing the command ionic generate page Contact.
Someone could help me
Voila l'erreur aprés avoir lancer la commande :
$ ionic generate page realisations
ng generate page realisations
Could not find module "#ionic/angular-toolkit" from "C:\wamp64\www\fil_Rouge\portfolioV4".
Error: Could not find module "#ionic/angular-toolkit" from "C:\wamp64\www\fil_Rouge\portfolioV4".
at Object.resolve (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\core\node\resolve.js:141:11)
at NodeModulesEngineHost._resolvePackageJson (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\schematics\tools\node-module-engine-host.js:28:21)
at NodeModulesEngineHost._resolveCollectionPath (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\schematics\tools\node-module-engine-host.js:69:40)
at NodeModulesEngineHost.createCollectionDescription (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\schematics\tools\file-system-engine-host-base.js:111:27)
at SchematicEngine._createCollectionDescription (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\schematics\src\engine\engine.js:147:40)
at SchematicEngine.createCollection (C:\Users\Stagiaire\AppData\Roaming\npm\node_modules#angular\cli\node_modules#angular-devkit\schematics\src\engine\engine.js:140:43)
So it looks like there are a bunch of missing modules from your ionic installation. I recommend uninstalling ionic globally, re-installing it and then starting a new project. After that, move into the directory of the new project and come back with the output of the ionic info command.
Commands for reference:
npm uninstall -g ionic (Uninstalling Ionic from machine)
npm install -g ionic (Installing it globally)
ionic start blank myApp (starting new app)
cd myApp (change directory to application Mac/Linux/Windows Powershell)
ionic info (Get ionic information )
I tied to create an ionic project v3 using the following command
ionic start myApp tabs
but the final result was an ionic v4 project.
How can I force ionic to crate a v3 project instead of v4 ?
You can use the below command to create a Ionic 3 Project when you have Ionic 4 installed
ionic start ProjectName blank --type=ionic-angular
For reference, you can do this without downgrading your Ionic CLI. Notice that --type=ionic-angular is the Ionic 4 CLI way of saying "Ionic 3". Here's a reference to that:
https://github.com/ionic-team/ionic-cli/issues/3862
If you run ionic start --list it will show the available templates and project types. For project type, angular would be Ionic 4, ionic-angular would be Ionic 3, and ionic1 is actually well named :-)
name | project type | description
--------------------------------------------------------------------------------------------------------------------------------
blank | angular | A blank starter project
sidemenu | angular | A starting project with a side menu with navigation in the content area
tabs | angular | A starting project with a simple tabbed interface
tabs | ionic-angular | A starting project with a simple tabbed interface
blank | ionic-angular | A blank starter project
sidemenu | ionic-angular | A starting project with a side menu with navigation in the content area
super | ionic-angular | A starting project complete with pre-built pages, providers and best practices for Ionic development.
tutorial | ionic-angular | A tutorial based project that goes along with the Ionic documentation
aws | ionic-angular | AWS Mobile Hub Starter
tabs | ionic1 | A starting project for Ionic using a simple tabbed interface
blank | ionic1 | A blank starter project for Ionic
sidemenu | ionic1 | A starting project for Ionic using a side menu with navigation in the content area
maps | ionic1 | An Ionic starter project using Google Maps and a side menu
Also note that you will not start out with cordova assets (e.g. config.xml). Adding a platform for the first time will pull that stuff in though.
You need to uninstall ionic globlally first:
npm uninstall ionic -g
then install a ionic 3 version you like so:
npm install ionic#3.20.0 -g
Now run
ionic info
you should see the ionic (Ionic CLI) : 3.20.0
Now you can install an ionic 3 app using the command you tried.
My boss gave me an ionic1 project, but my computer is the ionic3 environment. How can I package the project.
'python' : "v-2.7"
'node' : "v-8.9"
'cordova': 'v-7.1'
'ionic' : "v-3.18"
You have to just use this command
ionic start <YOUR APP NAME> --type=ionic1
hope this works for you
you can create new project from template also
ionic start [<project_name>] [<template>] --type=ionic1
example
ionic start myApp tabs --type=ionic1
for more info: https://ionicframework.com/docs/cli/start/
You can use the following code for building Ionic version 1 app in Ionic 3 environment
For sidemenu: ionic start yourappname sidemenu --type ionic1
For tabs: ionic start yourappname tabs --type ionic1
When I do this, I get the message below:
Command :
ionic start blank myapp --v2
Error :
[ERROR] Sorry! The --v1 and --v2 flags have been removed.
Use the --type option. (ionic start --help)
For Ionic Angular projects, try ionic start blank myapp --type=ionic-angular
My Ionic CLI version is :
ionic -v
3.3.0
Update 2 : You can no longer create Ionic 2 project in Ionic 3 CLI.
As Ionic 2 was not updated & is rewritten using Ionic 3, which uses Angular 4.
So if you create new Ionic project it will use Ionic 3 by default.
Update 1 : More Info Available Here
With the updates few changes are done in syntax as well :
To create a new project : (You have 3 templates available with Ionic i.e. blank, tabs, sidemenu)
ionic start {{AppName}} {{TemplateName}} ==> Latest Ionic codebase project
ionic start {{AppName}} {{TemplateName}} --type ionic1 ==> Ionic v1 project
Yes, You can check this link out
ionic start [app-name] [template] --type=ionic1
ionic start [app-name] [template] --type=ionic2
ionic start [app-name] [template] --type=ionic-angular
I have Ionic -v 2.2.2 right now so couldn't test it, so please try and let me know ;)
You don't have to specify --v2 for an Ionic 2 project because an Ionic 3 project is just an Ionic 2 project with some new features such as lazy loading and adoption of Angular 4 instead of Angular 2 .Just like Angular 2 and 4 are the same framework ,Ionic 2 and 3 are the same also
You can check in
ionic start --list
Starters for Ionic 2/3 (--type=ionic-angular)
name | description
-----------------------
tabs | A starting project with a simple tabbed interface
sidemenu | A starting project with a side menu with navigation in the content area
blank | A blank starter project
super | A starting project complete with pre-built pages, providers and best practices for Ionic development.
tutorial | A tutorial based project that goes along with the Ionic documentation
aws | AWS Mobile Hub Starter
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