Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With cordova-ios 5.0.0, phonegap-plugin-push cannot be added #523

Closed
3 tasks done
martispaul opened this issue Feb 13, 2019 · 9 comments
Closed
3 tasks done

With cordova-ios 5.0.0, phonegap-plugin-push cannot be added #523

martispaul opened this issue Feb 13, 2019 · 9 comments

Comments

@martispaul
Copy link

Bug Report

Problem

With cordova-ios 5.0.0, phonegap-plugin-push cannot be added

What is expected to happen?

Created new cordova ios app with ios platform 5.0.0, adding phonegap-plugin-push should be successfully.

What does actually happen?

Adding the phonegap-plugin-push fails on a new created app (with [email protected]).
On the older cordova-ios version (4.5.4), adding the plugin was successfully.

Information

Using windows PC, create a blank cordova app
Add platform [email protected]
Add plugin [email protected]

C:\Users\martispa\Desktop\TestIOS\hello>cordova platform add [email protected]
Using cordova-fetch for [email protected]
Adding ios project...
Creating Cordova project for the iOS platform:
Path: platforms\ios
Package: com.example.hello
Name: HelloWorld
iOS project created with [email protected]
Installing "cordova-plugin-whitelist" for ios
--save flag or autosave detected
Saving ios@~5.0.0 into config.xml file ...

C:\Users\martispa\Desktop\TestIOS\hello>cordova plugin add [email protected]
Installing "phonegap-plugin-push" for ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Failed to install 'phonegap-plugin-push': Error: ENOENT: no such file or directory, open 'C:\Users\martispa\Desktop\TestIOS\hello\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.readFileSync (fs.js:551:33)
at pbxProject.parseSync (C:\Users\martispa\Desktop\TestIOS\hello\node_modules\xcode\lib\pbxProject.js:61:28)
at Api.setSwiftVersionForCocoaPodsLibraries (C:\Users\martispa\Desktop\TestIOS\hello\platforms\ios\cordova\Api.js:587:18)
at C:\Users\martispa\Desktop\TestIOS\hello\platforms\ios\cordova\Api.js:448:26
at _fulfilled (C:\Users\martispa\Desktop\TestIOS\hello\node_modules\q\q.js:854:54)
at self.promiseDispatch.done (C:\Users\martispa\Desktop\TestIOS\hello\node_modules\q\q.js:883:30)
at Promise.promise.promiseDispatch (C:\Users\martispa\Desktop\TestIOS\hello\node_modules\q\q.js:816:13)
at C:\Users\martispa\Desktop\TestIOS\hello\node_modules\q\q.js:624:44
at runSingle (C:\Users\martispa\Desktop\TestIOS\hello\node_modules\q\q.js:137:13)
ENOENT: no such file or directory, open 'C:\Users\martispa\Desktop\TestIOS\hello\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'

Command or Code

cordova platform add [email protected]
cordova plugin add [email protected]

Version information

Node: v8.15.0
NPM: 6.4.1
Cordova: 8.1.2 ([email protected])
Cordova platform: [email protected]
[email protected]

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Can someone help me narrow the issue down to a platform ios maybe? Or should i raise this issue to the plugin specific github page (phonegap-plugin-push).
PS: Adding the plugin on platform [email protected] is successful.

@janpio
Copy link
Member

janpio commented Feb 13, 2019

I can confirm the problem:

E:\Projects\throwaway
λ cordova create pushIos5Repro
Creating a new cordova project.

E:\Projects\throwaway
λ cd pushIos5Repro\

E:\Projects\throwaway\pushIos5Repro  ([email protected])
λ cordova platform add [email protected]
Using cordova-fetch for [email protected]
Adding ios project...
Creating Cordova project for the iOS platform:
        Path: platforms\ios
        Package: io.cordova.hellocordova
        Name: HelloCordova
iOS project created with [email protected]
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for ios
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving ios@~5.0.0 into config.xml file ...

E:\Projects\throwaway\pushIos5Repro  ([email protected])
λ cordova plugin add phonegap-plugin-push
Installing "phonegap-plugin-push" for ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Failed to install 'phonegap-plugin-push': Error: ENOENT: no such file or directory, open 'E:\Projects\throwaway\pushIos5Repro\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'
    at Object.openSync (fs.js:439:3)
    at Object.readFileSync (fs.js:344:35)
    at pbxProject.parseSync (E:\Projects\throwaway\pushIos5Repro\node_modules\xcode\lib\pbxProject.js:61:28)
    at Api.setSwiftVersionForCocoaPodsLibraries (E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:587:18)
    at E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:448:26
    at _fulfilled (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:854:54)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:883:30
    at Promise.promise.promiseDispatch (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:816:13)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:624:44
    at runSingle (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:137:13)
ENOENT: no such file or directory, open 'E:\Projects\throwaway\pushIos5Repro\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'

(Similar version setup as @martispaul)

@janpio
Copy link
Member

janpio commented Feb 13, 2019

Just to confirm that this is a new thing: Works fine with [email protected]:

E:\Projects\throwaway
λ cordova create pushiOS4Repro
Creating a new cordova project.

E:\Projects\throwaway
λ cd pushiOS4Repro\

E:\Projects\throwaway\pushiOS4Repro  ([email protected])
λ cordova platform add ios
Using cordova-fetch for cordova-ios@~4.5.4
Adding ios project...
Creating Cordova project for the iOS platform:
        Path: platforms\ios
        Package: io.cordova.hellocordova
        Name: HelloCordova
iOS project created with [email protected]
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project
Installing "cordova-plugin-whitelist" for ios
Adding cordova-plugin-whitelist to package.json
Saved plugin info for "cordova-plugin-whitelist" to config.xml
--save flag or autosave detected
Saving ios@~4.5.5 into config.xml file ...

E:\Projects\throwaway\pushiOS4Repro  ([email protected])
λ cordova plugin add phonegap-plugin-push
Installing "phonegap-plugin-push" for ios
Adding phonegap-plugin-push to package.json
Saved plugin info for "phonegap-plugin-push" to config.xml

@janpio janpio added the bug label Feb 13, 2019
@janpio
Copy link
Member

janpio commented Feb 13, 2019

The Pods folder does not exist in platforms\ios (also didn't with 4.5.4, so this being expected seems to be new). Now the question is how and where this should be created. Probably something with Cocoapods.

@janpio
Copy link
Member

janpio commented Feb 13, 2019

Running the plugin add command with --verbose gives some additional output:

E:\Projects\throwaway\pushIos5Repro  ([email protected])
λ cordova plugin add phonegap-plugin-push --verbose
No scripts found for hook "before_plugin_add".
No version specified for phonegap-plugin-push, retrieving version from config.xml
No version for phonegap-plugin-push saved in config.xml or package.json
Attempting to use npm info for phonegap-plugin-push to choose a compatible release
Running command: cmd "/s /c "C:\Users\Jan\scoop\apps\nvm\current\nodejs\nodejs\npm.cmd view phonegap-plugin-push --json""
Command finished with error code 0: cmd /s /c "C:\Users\Jan\scoop\apps\nvm\current\nodejs\nodejs\npm.cmd view phonegap-plugin-push --json"
Running command: cmd "/s /c "E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\version.bat""
Command finished with error code 0: cmd /s /c "E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\version.bat"
Calling plugman.fetch on plugin "[email protected]"
saving
Running command: cmd "/s /c "C:\Users\Jan\scoop\apps\nvm\current\nodejs\nodejs\npm.cmd install [email protected] --production --save""
Command finished with error code 0: cmd /s /c "C:\Users\Jan\scoop\apps\nvm\current\nodejs\nodejs\npm.cmd install [email protected] --production --save"
Copying plugin "E:\Projects\throwaway\pushIos5Repro\node_modules\phonegap-plugin-push" => "E:\Projects\throwaway\pushIos5Repro\plugins\phonegap-plugin-push"
Calling plugman.install on plugin "E:\Projects\throwaway\pushIos5Repro\plugins\phonegap-plugin-push" for platform "ios
Installing "phonegap-plugin-push" for ios
Running command: cmd "/s /c "E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\version.bat""
Command finished with error code 0: cmd /s /c "E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\version.bat"
Finding scripts for "before_plugin_install" hook from plugin phonegap-plugin-push on ios platform only.
No scripts found for hook "before_plugin_install".
Install start for "phonegap-plugin-push" on ios.
PlatformApi successfully found for platform ios
Beginning processing of action stack for ios project...
Adding non-custom framework to project... PushKit.framework -> {"customFramework":false,"embed":false,"link":true,"weak":false}
Non-custom framework added to project. PushKit.framework -> {"customFramework":false,"link":true,"weak":false}
Action stack processing complete.
pods.json found in platforms/ios
Podfile found in platforms/ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
Adding pods since the plugin contained <framework>(s) with type="podspec"
Set pods.json for `libraries` - `FirebaseMessaging`
Added pod line for `FirebaseMessaging`
Wrote to pods.json.
Wrote to Podfile.
Running `pod install` (to install plugins)
==== pod install start ====

CocoaPods check and installation ignored on win32
==== pod install end ====

Failed to install 'phonegap-plugin-push': Error: ENOENT: no such file or directory, open 'E:\Projects\throwaway\pushIos5Repro\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'
    at Object.openSync (fs.js:439:3)
    at Object.readFileSync (fs.js:344:35)
    at pbxProject.parseSync (E:\Projects\throwaway\pushIos5Repro\node_modules\xcode\lib\pbxProject.js:61:28)
    at Api.setSwiftVersionForCocoaPodsLibraries (E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:587:18)
    at E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:448:26
    at _fulfilled (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:854:54)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:883:30
    at Promise.promise.promiseDispatch (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:816:13)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:624:44
    at runSingle (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:137:13)
ENOENT: no such file or directory, open 'E:\Projects\throwaway\pushIos5Repro\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'
Error: ENOENT: no such file or directory, open 'E:\Projects\throwaway\pushIos5Repro\platforms\ios\Pods\Pods.xcodeproj\project.pbxproj'
    at Object.openSync (fs.js:439:3)
    at Object.readFileSync (fs.js:344:35)
    at pbxProject.parseSync (E:\Projects\throwaway\pushIos5Repro\node_modules\xcode\lib\pbxProject.js:61:28)
    at Api.setSwiftVersionForCocoaPodsLibraries (E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:587:18)
    at E:\Projects\throwaway\pushIos5Repro\platforms\ios\cordova\Api.js:448:26
    at _fulfilled (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:854:54)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:883:30
    at Promise.promise.promiseDispatch (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:816:13)
    at E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:624:44
    at runSingle (E:\Projects\throwaway\pushIos5Repro\node_modules\q\q.js:137:13)

Seems Cocoapods is run during installation of the plugin. As this is not available on Windows, it is causing problems :/

It even seems to be aware of that:

CocoaPods check and installation ignored on win32

So why is it trying to read that file shortly after?

Looking at the code blame shows that the code is a pretty recent addition:
https://github.com/apache/cordova-ios/blame/c7c1f60aa50d58be413250c8c82a453ae6cd5b15/bin/templates/scripts/cordova/Api.js#L446

@janpio
Copy link
Member

janpio commented Feb 13, 2019

Ok, seems the "pod install does not exist on Windows" logic here might be just a tiny bit broken. Can you take a look @knight9999 as you authored the PR (and @erisu)?

@knight9999
Copy link
Contributor

Thanks for the report and valuable comments. @janpio @martispaul !
I sent new PR #528 to resolve this issue.

@dpogue dpogue added this to the 5.0.1 milestone Mar 2, 2019
@dpogue
Copy link
Member

dpogue commented Mar 2, 2019

PR #528 was merged, and will be part of [email protected]

@dpogue dpogue closed this as completed Mar 2, 2019
@Jasphine
Copy link

I have this issue too. How to fix this?

@Sentence
Copy link

Sentence commented Sep 17, 2019

@Jasphine probably you need to update your POD to latest, then go into platforms/ios, then pod install or pod repo update then pod install, this way i'm able to install the plugin without error. (Also something isn't correct with this version about this. I know the devs are overworked highly.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants