Ionic2: No provider Error

I am using Ionic2 rc4.

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.2.1 Build version 8C1002

I would like to add a service. I have other Services, that work perfectly. So I configure this new Service (PayPalService) the same.


import { Component, Inject, forwardRef } from '@angular/core';
import { PayPalService } from '../paypal/PayPalService';

  templateUrl: 'payPalTest.html'
export class PayPalTestPage {
  public payPalService: PayPalService = null;

  constructor( @Inject(forwardRef(() => PayPalService)) payPalService) {
    this.payPalService = payPalService;

  public payOut(): void {



declare var require: any;
var paypal = require('paypal-rest-sdk');
//import {paypal-rest-sdk} from './paypal-rest-sdk';
import { Injectable } from "@angular/core";

export class PayPalService {

    public paypal: any = null;

    constructor() {


import { PayPalService } from "../pages/paypal/payPalService";
import { PayPalTestPage } from "../pages/paypal/payPalTest";
  declarations: [
  entryComponents: [
  providers: [..., PayPalService]

However, I get the following error.


Runtime Error Error in ./MyApp class MyApp - caused by: No provider
for PayPalService!

I think the error is related to the way I import the 'paypal-rest-sdk'.

declare var require: any;
var paypal = require('paypal-rest-sdk');

I installed the paypal-rest-sdk as follows:

npm install paypal-rest-sdk

And the new package has been added to the node_modules.


Can anyone please suggest how I can resolve the above error please?


If I remove all reference to the PayPal api by commenting out the following two lines:


// declare var require: any;
// var paypal = require('paypal-rest-sdk');

I get the following error:


Runtime Error Module build failed: Error: ENOENT: no such file or
directory, open
at Error (native)

Is there a reason you aren’t using the Ionic Native PayPal plugin?

The reason I am not using the ionic-native version of PayPal is because it does not do PayOuts (make payments to other PayPal accounts). The paypal-rest-sdk does.

It was a really silly mistake by me. The import had the incorrect case.



import { PayPalService } from '../paypal/PayPalService';


import { PayPalService } from '../paypal/payPalService';