【问题标题】:Unable to add fcm plugin in ionic 2 app无法在 ionic 2 应用程序中添加 fcm 插件
【发布时间】:2018-02-09 12:38:31
【问题描述】:

我正在尝试在我的项目中添加 fcm 插件,但它显示以下错误

 ionic cordova plugin add cordova-plugin-fcm
> cordova plugin add cordova-plugin-fcm --save
Error: Failed to fetch plugin file:node_modules/cordova-plugin-fcm via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 4294963238 Error output:
npm ERR! addLocal Could not install F:\PROJECTS\IONIC2\foodJunctionMobileApp\node_modules\cordova-plugin-fcm
npm ERR! Windows_NT 10.0.16299
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "file:node_modules/cordova-plugin-fcm" "--production" "--save"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! path F:\PROJECTS\IONIC2\foodJunctionMobileApp\node_modules\cordova-plugin-fcm
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'F:\PROJECTS\IONIC2\foodJunctionMobileApp\node_modules\cordova-plugin-fcm'
npm ERR! enoent ENOENT: no such file or directory, open 'F:\PROJECTS\IONIC2\foodJunctionMobileApp\node_modules\cordova-plugin-fcm'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     F:\PROJECTS\IONIC2\foodJunctionMobileApp\npm-debug.log

这是我的

离子信息

cli packages: (C:\Users\Rohit\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    Node              : v6.9.5
    npm               : 3.10.10
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:\Users\Rohit\AppData\Local\Android\sdk

Misc:

    backend : pro

我已连接到互联网,所以这不是问题。我在安装 fcm 之前添加了 google plus 插件,当时它与 fcm 插件冲突,所以我删除了 google plus 插件并尝试只安装 fcm 但失败了。如果有人知道它,请提供帮助。谢谢。

【问题讨论】:

    标签: ionic2 ionic3 ionic-native cordova-plugin-fcm


    【解决方案1】:

    我使用这个 firebase 插件:

    https://www.npmjs.com/package/cordova-plugin-firebase

    你可以这样安装它:

    cordova plugin add cordova-plugin-firebase@0.1.24 --save
    

    它也适用于最新的离子版本。

    【讨论】:

      【解决方案2】:

      您可以按照本教程进行操作,它解释了您在此过程中可能遇到的所有错误,希望对您有所帮助。

      https://www.djamware.com/post/58a1378480aca7386754130a/ionic-2-fcm-push-notification

      【讨论】:

        猜你喜欢
        • 2018-02-08
        • 1970-01-01
        • 1970-01-01
        • 2017-11-04
        • 2017-03-31
        • 1970-01-01
        • 1970-01-01
        • 2018-04-10
        • 2017-04-29
        相关资源
        最近更新 更多