jlcvp / fcm-node

A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM) for Android & iOS & Web Notification and data push
MIT License
125 stars 46 forks source link

Could not find a declaration file for module 'fcm-node'. #48

Closed abhinav098 closed 5 years ago

abhinav098 commented 5 years ago

I am using a cordova based hybrid mobile app. My app is built using ember@2.13. I need to integrate fcm push-notifications to my app, I'm using phonegap-plugin-push@2.1.2.

I added the package into my package.json. By doing yarn add fcm-node. Then I imported it in my controller file, by writing code like => import FCM from 'fcm-node';, / import * as FCM from 'fcm-node';/ also tried var FCM = require('fcm-node');

When I install the app or try to run it on browser, i get an error:

    Error: Could not find module `fcm-node` imported from `stock/controllers/notifications`
    at missingModule (vendor.js:252)
    at findModule (vendor.js:263)
    at Module.findDeps (vendor.js:173)
    at findModule (vendor.js:267)
    at requireModule (vendor.js:29)
    at Class._extractDefaultExport (vendor.js:133203)
    at Class.resolveOther (vendor.js:132900)
    at Class.superWrapper [as resolveOther] (vendor.js:60493)
    at Class.resolveController (vendor.js:27961)
    at Class.resolve (vendor.js:27811)

And even in my vs-code its highlighted with error Screen Shot 2019-05-27 at 1 03 48 PM

Same issue with the require statement too.

I even tried installing by npm install @types/fcm-node. But still no luck.

Could you please help me resolve this ?

jlcvp commented 5 years ago

This library is meant to be used in back-end code and doesn`t have a typing declaration file for typescript. Use it as a common javascript lib