fcm icon indicating copy to clipboard operation
fcm copied to clipboard

Ionic integration compatible?

Open jllaurado opened this issue 4 years ago • 2 comments

Describe the bug I'm trying to use the module on ionic with capacitor and it give me an error. Following your instructions I've added an:

import { FCM } from '@capacitor-community/fcm';

in my fcm service but I'm not able to build, with the error:

Error: src/app/services/push.service.ts:12:21 - error TS2307: Cannot find module '@capacitor-community/fcm' or its corresponding type declarations.

12 import { FCM } from '@capacitor-community/fcm'; ~~~~~~~~~~~~~~~~~~~~~~~~~~ I've installed the module using:

$ npm i @capacitor-community/fcm

It seems trivial, but is it possible that it's imcompatible with ionic this module?

thanks.

jllaurado avatar Oct 21 '21 11:10 jllaurado

Did you cap sync as described in the README?

ptmkenny avatar Oct 21 '21 11:10 ptmkenny

Thanks for the quick answer.

Yes, I've done it multiple times, and it detects the module also, but then you can see the error below. Here my steps:

$ ionic cap sync

ng.cmd run app:build .... Build at: 2021-10-21T11:21:17.088Z - Hash: 3b895d3e734b7c7916ac - Time: 13651ms capacitor.cmd sync [capacitor] √ Copying web assets from www to android\app\src\main\assets\public in 9.12s [capacitor] √ Creating capacitor.config.json in android\app\src\main\assets in 2.57ms [capacitor] √ copy android in 9.42s [capacitor] √ Updating Android plugins in 7.83ms [capacitor] [info] Found 6 Capacitor plugins for android: [capacitor] @capacitor-community/[email protected] [capacitor] @capacitor/[email protected] [capacitor] @capacitor/[email protected] [capacitor] @capacitor/[email protected] [capacitor] @capacitor/[email protected] [capacitor] @capacitor/[email protected] [capacitor] √ update android in 146.57ms [capacitor] √ copy web in 818.60μp [capacitor] √ update web in 793.80μp [capacitor] [info] Sync finished in 9.582s

jls@localhost:~/Development/bbs/test-fmc (master) $ ionic cap build --prod android

ng.cmd run app:build:production

  • Generating browser application bundles (phase: setup)... √ Browser application bundle generation complete. √ Browser application bundle generation complete.

./src/app/app.module.ts:6:0-47 - Error: Module not found: Error: Can't resolve '@capacitor-community/fcm' in 'C:\Users\jls\Development\test-fmc\src\app'

Error: src/app/app.module.ts:9:21 - error TS2307: Cannot find module '@capacitor-community/fcm' or its corresponding type declarations.

9 import { FCM } from '@capacitor-community/fcm'; ~~~~~~~~~~~~~~~~~~~~~~~~~~

jllaurado avatar Oct 21 '21 11:10 jllaurado

I can't reproduce using latest ionic, capacitor and plugin, so it's probably fixed or related to some dependency in your project.

If you still face the issue, please, create a new one and provide a sample app where the issue can be reproduced.

jcesarmobile avatar Oct 20 '22 16:10 jcesarmobile