使用Cordova Push Phonegap-plugin-push 1.8.0的PhoneGap Windows Build Fail

时间:2017-11-08 00:25:40

标签: ios windows cordova push-notification phonegap-build

我使用带有推送通知插件的cordova构建了一个APP。我使用PhoneGap构建它,它成功构建并适用于Android和IOS但我在Windows构建时遇到错误...

版本 PhoneGap(iOS / Android / Windows) cli-6.5.0(4.3.1 / 6.1.2 / 4.4.3)

PhoneGap日志:

    Build Date: 2017-11-08 00:12:04 +0000
--------------------------------------------------------------------------------
PLUGIN OUTPUT
--------------------------------------------------------------------------------
Fetching plugin "cordova-plugin-statusbar@~2.1.3" via npm
Installing "cordova-plugin-statusbar" at "2.1.3" for windows
"plugman.cmd install --platform windows --project /cygwin/project --plugin phonegap-plugin-push@~1.8.0 --var SENDER_ID=990801368143": Fetching plugin "phonegap-plugin-push@~1.8.0" via npm
Installing "phonegap-plugin-push" at "1.8.4" for windows
Updating appxmanifests with ToastCapable=true...
Failed to install 'phonegap-plugin-push': Error: Cannot find module 'C:\project\platforms\windows\cordova\lib\AppxManifest'
    at Function.Module._resolveFilename (module.js:337:15)
    at Function.Module._load (module.js:287:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at module.exports (C:\project\cordova\plugins\phonegap-plugin-push\hooks\windows\setToastCapable.js:5:24)
    at runScriptViaModuleLoader (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:189:18)
    at runScript (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:165:16)
    at C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:133:20
    at _fulfilled (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\q\q.js:816:30)
Cannot find module 'C:\project\platforms\windows\cordova\lib\AppxManifest'

PhoneGap构建错误:

Error - Plugin error (you probably need to remove plugin files from your app): Fetching plugin "phonegap-plugin-push@~1.8.0" via npm Installing "phonegap-plugin-push" at "1.8.4" for windows Updating appxmanifests with ToastCapable=true... Failed to install 'phonegap-plugin-push': Error: Cannot find module 'C:\cygwin\tmp\gimlet\xxxxxxxx\project\platforms\windows\cordova\lib\AppxManifest' at Function.Module._resolveFilename (module.js:337:15) at Function.Module._load (module.js:287:25) at Module.require (module.js:366:17) at require (module.js:385:17) at module.exports (C:\cygwin\tmp\gimlet\xxxxxxxx\project\cordova\plugins\phonegap-plugin-push\hooks\windows\setToastCapable.js:5:24) at runScriptViaModuleLoader (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:189:18) at runScript (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:165:16) at C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\pgb-cordova-lib\src\hooks\HooksRunner.js:133:20 at _fulfilled (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\q\q.js:787:54) at self.promiseDispatch.done (C:\Users\Administrator\AppData\Roaming\npm\node_modules\pgb-plugman\node_modules\q\q.js:816:30) Cannot find module 'C:\cygwin\tmp\gimlet\2870062\project\platforms\windows\cordova\lib\AppxManifest' - You can fix this here

我的config.xml:

<plugin name="cordova-plugin-statusbar" source="npm" spec="~2.1.3" />
<plugin name="phonegap-plugin-push" source="npm" spec="~1.8.0">
    <variable name="SENDER_ID" value="my_firebase_id" />
</plugin>
<plugin name="cordova-plugin-battery-status" source="npm" spec="~1.1.1" />

我试过更改版本但没有运气......任何人都知道为什么?

1 个答案:

答案 0 :(得分:1)

我找到了一个解决方案......问题是PhoneGap仅适用于推送通知1.8.1

这样改变了我的config.xml文件

<plugin name="phonegap-plugin-push" source="npm" spec="1.8.1">
    <variable name="SENDER_ID" value="my_firebase_id" />
</plugin>