我正在尝试在项目中添加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:PROJECTSIONIC2foodJunctionMobileAppnode_modulescordova-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:PROJECTSIONIC2foodJunctionMobileAppnode_modulescordova-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:PROJECTSIONIC2foodJunctionMobileAppnode_modulescordova-plugin-fcm'
npm ERR! enoent ENOENT: no such file or directory, open 'F:PROJECTSIONIC2foodJunctionMobileAppnode_modulescordova-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:PROJECTSIONIC2foodJunctionMobileAppnpm-debug.log
这是我的
离子信息
cli packages: (C:UsersRohitAppDataRoamingnpmnode_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:UsersRohitAppDataLocalAndroidsdk
Misc:
backend : pro
我已连接到互联网,这不是问题。在安装FCM之前,我添加了Google Plus插件,那时它与FCM插件发生了冲突,因此我删除了Google Plus Plugin,并尝试仅安装FCM,但失败了。谢谢。
我使用此firebase插件:
https://www.npmjs.com/package/cordova-plugin-firebase
这就是您可以安装它的方式:
cordova plugin add cordova-plugin-firebase@0.1.24 --save
它还可以与LATES IONIC版本一起使用。
您可以遵循本教程,它解释了您在此过程中可以遇到的所有错误,希望这会有所帮助。
https://www.djamware.com/post/58A1378480ACA7386754130A/Ionic-2-fcm-push-notification