How to create a new provider?


#1

Hi, all,
Thanks in advance.

I would like to develop an application for iPhone 7 that uses REST API on Ionic 2 and Windows 10.
However, executing the command according to the following procedure will result in an error.

Link:
10 Minutes with Ionic 2: Calling an API
Command:

ionic g provider PeopleService

ErrorDetail:

Microsoft Windows [Version 10.0.14393]
© 2016 Microsoft Corporation. All rights reserved.

C:\App\App\App\App.App.App1>ionic g provider PeopleService


Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:

Please install your Cordova CLI to version >=4.2.0 npm install -g cordova


Generators are only available for Ionic 2 projects (CLI v2.2.3)

Your system information:

Cordova CLI: 7.0.0
Ionic Framework Version: 3.2.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.10.0
Xcode version: Not installed

The same error occurs even if the version of Ionic CLI is 2.0.0 or 2.1.0, and create new project. Please give me a hint as to what to do and how to make a provider.


#2

Please install your Cordova CLI to version >=4.2.0 npm install -g cordova

Have your tried installing a new version of Cordova?


#3

This error shows up because he didn’t run the cordova telemetry on command

As you can see, he installed Cordova CLI 7.0 (the latest release)


#4

This is probably not a popular opinion, but I recommend avoiding the generators and just creating things by hand.


#5

Hi,All. Thank you for your reply!
I ran “npm install - g cordova” and put the latest version of Cordova CLI,and execute ‘cordova telemetry’,but the same error occurred.

Generators are only available for Ionic 2 projects (CLI v2.2.3)

Your system information:

Cordova CLI: 7.0.0
Ionic Framework Version: 3.2.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.7
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.10.0
Xcode version: Not installed


#6

Are you sure you have a current project and not a v1 one?