1

since I updated my mac to Sierra I noticed a strange behaviour in my cordova app: some plugins aren't working anymore, it just seems they are not copied in the ios platform even if when I add the Platform the plugins' folders are copied as usual. It just seems xcode ignore them. I tried a few things: removing and adding again plugins, updating cordova, uninstalling and reinstalling cordova, updating platforms, trying creating a brand new app... nothing seems to fix the problem. Searching around I found this command:

$ cordova platform update ios --save

and it worked without doing anything else. Unfortunately I have to use this command everytime I make a change in the app and I remove and add the platform again so I guess it's a problem in my environment.

I would like to completely uninstall cordova, node.js and git and reinstall everything again. I found a few instructions like in this question for node.js How do I uninstall nodejs installed from pkg (Mac OS X)? but I don't know how to run correctly all of the commands, some of them fail.

Uninstalling cordova and reinstalling works but doesn't solve the problem. I did it with

$ sudo npm install -g cordova
$ sudo npm uninstall -g cordova

Can someone link me where to find clear instructions step by step? I'm not that good with command line and I really want to fix this problem without formatting the whole system.

Thank you for any help!

Community
  • 1
  • 1
flauros
  • 45
  • 2
  • 8

2 Answers2

1

Think I have the solution: I removed cordova,

sudo npm uninstall -g cordova

deleted the .cordova folder in my user home folder (it's a hidden folder!) and installed cordova again with

sudo npm install -g cordova

I noticed that one of my old cordova projects was working: remove platform, add platform and by default I had ios platform version 4.3.0. GOOD! In another cordova project created after latest update it was still using ios platform 4.2.1. In the root project folder there is the config.xml file and in this file I found this line in just the second project:

<engine name="ios" spec="~4.2.1" />

Just removed and now cordova is using by default the latest version of the ios platform.

I don't know exactly why in one project there was this line and why not in the other one... neither know if I updated the platform in one project before reinstalling cordova and after reinstalling in onther... can't remember.

I just know that now if I create a new project it's correctly using ios platform 4.3.0 and I tried to describe all my steps... I hope it will be useful for anyone else because I was ready to format my mac to fix this :(

flauros
  • 45
  • 2
  • 8
-2

I don't think you really have a problem with node or npm.

It seems to me more the kind of problem that happen when you change your node version without rebuilding node_modules directory.

If you always install modules with --save modifier, try this:

rm -rf node_modules
npm install

...if not, you can make a backup of your node_modules first. But it will be useful only to inspect it to figure out what modules are missing in your 'package.json' file.

bitifet
  • 3,514
  • 15
  • 37
  • Tried what u said but didn't change anything... I found out that if I add the platform and then update it works... Something like: $ cordova platform rm ios $ cordova platform add ios $cordova platform update ios – flauros Oct 25 '16 at 18:10
  • Then, my answer is not the right for you. The only idea that arises to me is to make a full copy of your project just befere executing `cordova platform update ios --save` and then examine a `diff -R` of both directories. This way maybe you could find some clue about what is happening… – bitifet Oct 25 '16 at 20:33
  • I found out that in my "user"/.cordova/lib/npm_cache/cordova_ios/ there are both platforms 4.2.1. and 4.3.0 When I run cordova platform add ios it always adds the 4.2.1. version and I have to update to 4.3.0 to make my app work when I run it from xcode. Is there a way to make cordova always add the platform with the latest version? – flauros Nov 01 '16 at 15:08