Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Could not find module ember-cli-cordova-shims/services/notifications #4

Open
shadowbrush opened this issue Aug 16, 2015 · 11 comments

Comments

@shadowbrush
Copy link

We're trying to get push notifications to work in our Ember/Cordova project. Following the instructions in your readme, we installed the two cordova plug-in dependencies (device, PushPlugin), and ran npm i ember-cli-cordova-shims. We added the initializer, but the import fails with: Uncaught Error: Could not find module 'ember-cli-cordova-shims/services/notifications'. We do have a /node_modules/ember-cli-cordova-shims. Thanks!

@theodorton
Copy link
Contributor

I'll look into this tomorrow. Thanks for your feedback :)

@theodorton
Copy link
Contributor

Are you on v0.3.0?
Also could you try the following instead and see how that works?

import NotificationsService from "{your-app}/services/notifications";
...

@rocketbop
Copy link

Hi Theo, I have the same problem as parent. :/ Using version 3.0.0

I did:

cd node_modules/
git clone git@github.com:Skalar/ember-cli-cordova-shims.git
cd ember-cli-cordova-shims
npm install
bower install

But the import cannot be found, exactly the same as above. I also tried;

import NotificationsService from 'ember-cli-cordova-shims/app/services/notifications';

Uncaught Error: Could not find module ember-cli-cordova-shims/services/notifications imported from my-app/initializers/pushplugin

EDIT: My issue seems to have just gone away. 🎱

@shadowbrush
Copy link
Author

Hi, thanks for responding so quickly! Did you make any changes? It is now working, with the import line from the readme!

Over the weekend, when I tried to add ember-cli-cordova-shims to package.json, I received an error message from npm. That error message is now gone.

Thanks again!

Holger

@shadowbrush
Copy link
Author

Hi Theo(?),

I've run into another issue. Following your readme instructions, I've added the service to the Ember application routes, and hooked up a button with the subscribeForNotifications action. However, this line in routes/application.js:

    this.notifications.register().then(function (data) {

raises the following exception:

    Uncaught TypeError: this.notifications.register is not a function

The object this.notifications is set to function members@service:notifications. Any ideas?

I never answered your earlier question: yes, I am using version 0.3.0.

Thanks!

Holger

@rocketbop
Copy link

Yep, I have the same issue. I debugged, and in the console, and this.notifications is a function.

@theodorton
Copy link
Contributor

You should use this.get('notifications').register... :)

@rocketbop
Copy link

That doesn't seem to work, still. I get:

Uncaught TypeError: this.get(...).register is not a function

🐙

@shadowbrush
Copy link
Author

I'm new to Ember services, and don't know what to expect from the "notifications" objects, but here are the "own" methods available from the object:

willReopen,name,_lazyInjections,isMethod,extend,length,ClassMixin,super,_onLookup,detect,eachComputedProperty,_computedProperties,caller,proto,createWithMixins,reopen,_toString,isClass,detectInstance,_initMixins,reopenClass,isServiceFactory,superclass,toString,ember_meta,ember_listens,_initProperties,_super,_debugContainerKey,PrototypeMixin,arguments,prototype,metaForProperty,create

@shadowbrush
Copy link
Author

I think it may have been an Ember version conflict (I'm on 1.13.1). I moved the service to /app/services, removed the initializer, some minor changes, and it's working now. Paul, if you want my code, ping me. Theo, thanks for you help!

Holger

@rocketbop
Copy link

Hey thanks Shadowbrush, that would be amazing! I stopped trying to get it to work last week as i was working on some other parts of my appl, but would love to give it another go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants