Visual Studio 2015 RTM Cordova IOS Build Error - Could not find module 'Q' - ios

I am using Visual Studio 2015 RTM, and I am working on a Cordova project. My project works fine for Android, but I cannot get it to build for IOS. I have figured out what the problem is, but I cannot figure out how to fix it.
When I build for IOS it is sending the build to the remote build agent installed on my Mac computer, but it is returning the following error:
Could not find module 'Q'. Please Go to Tools --> Options --> Tools
for Apache cordova --> Cordova Tools --> Clear Cordova Cache and try
building again.
Following it's suggestion and clearing the Cordova cache does not help. I did some research and have found that it is a bug in the cordova_ios library. Here is a link to the commit that fixed the error https://github.com/apache/cordova-ios/commit/ed272032878959c90eb28ccc1490e96fb7b69287.
Basically what the issue is that the check_reqs.js file is require 'Q' (uppercase) instead of 'q' (lowercase).
I can work around the problem (and confirm that this is the problem) by doing the following:
Copy my Cordova project over to my Mac computer.
At the command line add IOS as a Cordova platform.
Go to the /platforms/ios/cordova/lib/check_reqs.js file and change line 25 to be a lowercase 'q'.
Build and run the project on the Mac.
What I don't know is how to fix this in Visual Studio so I can build from Visual Studio? I have tried doing NPM updates on the computer that Visual Studio is installed on, but that has not fixed it. I have also tried to manually add the IOS platform to my project via the Cordova command line, and then changing the same file that I change on the Mac, but that does not fix it either.
It looks like this issue if fixed in the latest version of the cordova_ios library, I just cannot figure out how to get Visual Studio and/or the remote build agent on my Mac to use the latest version of the cordova_ios library.
Update
It looks like this is a bug that other people are seeing with Cordova. There are discussion about it here and here. I can reproduce this on my Mac computer. If I create a new Cordova project and add the iOS platform and try to build it for iOS I receive this error. I can then correct the issue by opening the check_reqs.js file and changing the uppercase 'Q' to a lowercase 'q'. However when I build from Visual Studio it sends the project across to the Mac with the incorrect check_req.js file and the build fails. I cannot figure out how to correct this issue when doing a iOS build from Visual Studio.

If your OSX machine has case a case sensitive filesystem you can hit this though a fix is in the works. (Most people do not turn on case sensativity.)
The fix you reference has not yet been released publicly. You can watch for a "platform" release here: http://cordova.apache.org/
Once the platform is released it is very likely a Cordova CLI update will also occur (ex: 5.1.2) so you can just update to that version via the config designer.
However, as an alternative you can add the following into your config.xml file to cause Cordova to use a different iOS platform version and then do a "clean" in VS to force it to take effect:
<engine name="ios" spec="3.9.0" />
3.8.0 is the currently released version.
A "DISCUSS" thread is already going for an iOS release - it should be out in the next couple of weeks.
You can try using the Git URI to get edge - but that could be buggy so exercise care:
<engine name="ios" spec="https://github.com/apache/cordova-ios.git" />

I think we should simply do a patch release of Cordova with this bug fix. Will start a thread on the mailing list to see if a quick release is possible.

Did you already try re-installing vs-tac? Here's the doc:
https://msdn.microsoft.com/library/dn771551(v=vs.140).aspx#vstac

What version of node do you have installed on the MAC machine? I have 0.12.2 and the require(Q) gets satisfied without any errors. Can you try installing a newer version of Node? Let me know.

Related

webGL and iOS Build Support Install failed -Unity

I don't know why I am getting this error. how can i solve this ?
(Visual studio 2019 was already installed but I never had access to the others)
Sometimes it happens... Moreover, it may not be possible to reinstall the module, since it is already marked as installed. In this case, you can do the following:
Find the folder where Unity is installed. For example: C:\Program Files\UnityEditor\2021.2.13f1
Open the modules.json file
Find the object with the parameter "name":"iOS Build Support" and in this object change the parameter "selected":true to "selected":false
Restart Unity Hub and try to reinstall iOS Build Support module
Also make sure you have enough disk space to install the components

Cordova Plugin Add/Remove for windows on a Mac

I am developing an app in Cordova that runs on iOS, Android, Windows and OSX. Everything is fine until you have to add or remove plugins. I develop the iOS, Android and OS X on a mac, and the Windows UWP on a windows machine.
When you try to add or remove a plugin you are stuck because on the mac I get the following error: "The platform "windows" does not appear to be a valid cordova platform." and fails.
When you try to add or remove a plugin on windows I get the following error: "The platform "android (or ios or osx)" does not appear to be a valid cordova platform." and fails.
Currently I remove windows from the platforms on the Windows computer, check the project in to github, check it out on my mac and and edit plugins for android/ios/osx then check it back in. After that I pull on my Windows and re-add the platform. The problem with this is cordova does not remember any images, app store associations, nuget packets etc making it a painstaking process that leads to many bugs.
Is there a way to ONLY add/remove a plugin on windows on the windows computer, and only for ios/android/osx on the mac and somehow make it all go together?
I would suspect this is happening because the platforms are not being successfully installed / removed. If you look in the platforms/ folder, check to see that the platforms that are acting up actually have valid folder structure and contents. If this is the case you need to manually remove the platforms.
Instead of removing the windows platform and committing to git, you should consider using the --nosave option: cordova platform remove windows --nosave. This way the changes are not saved to your package.json or configuration.xml. This would allow you to make changes on OSX without having to constantly check in the removed windows platform.
Something that may help is using the cordova repository management tool that I have created: https://www.npmjs.com/package/cordova-clean. This will help making sure all of the changes being made to the configuration are reflected in your current working directory across your machines / branches.

Install version cordova-ios 4.3.0 for visual studio and issue with cordova command not existing in CLI

Someone has asked the exact question I need on this page.
However, as I am new, my rep will not allow me to comment yet! So I have had to create a new question.
A guy in the question linked above suggests to "Type cordova platform add ios;". So there I suppose is where my question is different.
When I type Cordova in cmd prompt, I get a message saying "cordova is not recognized as an internal or external command, operable program or batch file."
Update: Please note, I have followed these steps: http://cordova.apache.org/docs/en/7.x/guide/cli/ And I am able to run the npm commands in CLI. I was hoping to simply update my ios version only.
I have also looked up PATH but I have no idea where to start, problem is, people suggest that I shouldn't need to adjust PATH as running the CLI commands to install the Cordova CLI should just allow me to use it?
So to summarize:
I downloaded the node.js and installed it
I typed this into cmd "npm install -g cordova" which installed
I type "cordova" and get my "cordova is not recognized as an internal or external command" message above
My aim is to upgrade my cordova-ios 4.2.0 to cordova-ios 4.3.0 to fix my main error of "remote build requires your projects to use cordova-ios 4.3.0 or greater with XCode 8.3"
Update 2 9th oct 2017:
I have given up for now with the above, to work around this i installed Node.js 8.6.0 then updated cordova using npm... im now facing some more issues that I am again stuck on and will create a new question.
Hopefully in the meantime, someone can answer this question and i can try again.
I suspect my issues could be relating to the fact i installed VS 2017 and used all the built in nuget packages (for cordova and node.js) and they are conflicting with the manual way in some way (i suspect that, as running the "cordova" command on my other PC worked fine!)

Problems with cordova remote build from visual studio to ios seems to be because of the phonegap push plugin

First of all, I am developing a Cordova app for Android and iOS, primarily.
I was using the deprecated version of the Phone gap push plugin:
https://github.com/phonegap-build/PushPlugin
Now I am using the new version:
https://github.com/phonegap/phonegap-plugin-push
And all my code is also using the new push plugin; I seem to not be able to get rid of the old push plugin completely and it sucks :(
It is beyond me how the old push plugin has a version number of 2.5 whereas the new push plugin has a version number of 1.5 or 1.6.. But moving on.
I am running the app on Android, and everything is ok. The app is running and working as supposed to. I am also successfully receiving notifications.
On iOS, also, everything was working as supposed to till give or take a month ago; but today when trying to deploy on an iOS device using Taco remote build from a windows pc (visual studio) to an apple macbook pro, I began facing many problems.
I then noticed that in the config.xml of the application (the one in the root of the project) there were both the old and the new push plugin. I mistakenly deleted the new one (because of the misleading version numbers; I thought it was in fact the old one). It seemed to run properly for a bit (on both Android and iOS) but after a while, I noticed that in reality the app was not going to work properly as it needed the new push plugin and it was not being found. So I deleted the old push plugin and installed the new push plugin (which happened to be also a more updated version of the new push plugin that I previously had).
Presently, my problem is that when running via taco remote build, the app manages to successfully deploy on an iOS device (iPhone 6) - so yes the remote build seems to be happening correctly!, however the app seems to not be recognising/locating/finding the new push plugin when running. I am suspecting that the new push plugin is not being transferred from visual studio on my windows pc into my apple macbook pro through the taco remote build.
In this directory: /Users/Jurgen/.taco_home/
I can see the build, with all the generated files. In the outermost plugins folder I can see the phonegap-plugin-push folder referring to the new push plugin:
/Users/Jurgen/.taco_home/remote-builds/taco-remote/builds/16880/cordovaApp/plugins/phonegap-plugin-push
Going further into the directory, into the platforms folder/ios/www/plugins etc, there is no phonegap-plugin-push:
/Users/Jurgen/.taco_home/remote-builds/taco-remote/builds/16880/cordovaApp/platforms/ios/www/plugins/-----
I think this might be the cause of the problem: though I am not 100% sure.
I thought that the iOS build most probably uses the plugins folder from the www folder inside the iOS folder and not the outermost (in the first directory shown above): And since the push plugin was nowhere to be seen inside there; that could have been the problem, even more so when bearing in mind that the .xcodeproject file resides in the same 'ios' folder.
So what I did was manually copy the push plugin folder into the innermost directory; which didn't work either. Even if it did, it does not really make sense and is highly inconvenient.
What can I do to ensure that the plugin is transferred into the iOS build with taco remote build? Could the problem be something else rather than what I suspect?
I am completely stuck; so any help would be greatly appreciated!
It sounds like the remote project is confused. Try this to see if it helps:
On your non-mac machine, ensure that only the correct plugin is referenced. This includes both config.xml and in the plugins folder. Consider removing the plugin entirely, then re-adding the correct version. If other plugins specify a dependency on the push plugin in their plugin.xml then that may also cause problems, especially if the biggest version number is not the latest version. You may need to remove those plugins too.
Once that is done, perform a clean build. Via taco-cli this would be taco build ios --clean, with whatever other device etc flags you want. Using Visual Studio you would go to build -> clean i believe.
This should copy your project in its entirety again, and avoid issues with conflicting plugin versions partially persisting.

Visual Studio iOS deployment fails because "The edge module has not been pre-compiled"

I am trying to deploy a HTML/CSS/JS Apache Cordova application from a windows machine to a Mac. I believe they are communicating properly through the remotebuild agent but when I attempt to build a blank project to deploy on the Mac this error is thrown at the very beginning of the build:
MDAVSCLI : error : The edge module has not been pre-compiled for node.js version v4.1.1. You must build a custom version of edge.node. Please refer to https://github.com/tjanczuk/edge for building instructions.
I have followed the link and have searched for the solution as to how to fix this error but the link does not seem to apply to what I am doing at all. I am not using any node.js functions in my code so I am confused as to why this error is occuring. I am only trying to build a nearly blank HTML page and I still get the error regardless of how simple I make the page.
How can I go about fixing this solution? what is the best way to get rid of this error or to as the error suggests pre-compile edge to work with node.js version 4.1.1?
There is an issue with Cordova 5.3.1 and Node v4.
https://github.com/Microsoft/cordova-docs/blob/master/articles/known-issues/known-issues-ios.md#building-for-ios-hangs-when-nodejs-v40-is-installed
I fixed by uninstalling Node v4.1.1 and installing Node v0.12.7
https://nodejs.org/en/download/releases/
#Dustin,
you have a misconception about how Cordova works. You say you want to deploy to a Mac, but I think you mean iOS. If so, you should read:
What's needed for iOS Development?
https://groups.google.com/forum/?fromgroups=#!topic/phonegap/bf1Hgkel3W4
I Quote
The short and sweet of it is as follows:
You need OS X + Xcode
You need several iDevices
You need $99/year for Apple Developer program (which you've already indicated is not a problem)
All of the above = cost-of-doing-business.
If you read the entire thread (especially the part from Kerri Shotz), you will get more information and more options.
Best of Luck
After losing a fair bit of hope and following a lot of posts, blogs and bug work-arounds with no luck I decided to click on the 'Run Dependency Checker' button in Visual Studio - Tools -> Options -> Tools For Apache Cordova -> Cordov Tools. This checker told me that Joyent Node.js wast installed. I did have node.js and npm set up on the latest version, im not sure what the difference is.
I went through the process of modifying the VS installation (change or remove a program) and sure enough Joyent Node.js wasnt checked. I cheked it and it went through the process of installing.
My VS installation now looks like the below and my project is building without:
MDAVSCLI : error : The edge module has not been pre-compiled for node.js version v4.1.1

Resources