A workaround solution
@wadebuildotto’s suggestion is a workable approach, so try that. To make it easier, I’ve prepared a script for UNIX-like systems:
curl -o .meteor/local/cordova-build/node_modules/cordova-common/src/FileUpdater.js https://gist.githubusercontent.com/nachocodoner/f05359529b8d0f9899051cb7c85d9f78/raw/e2a48d7802423d3ad4d36897c48dd6a6377447d4/FileUpdater.js
Run this in the root of your Meteor app after encountering the error for the first time, as mentioned. If you clean .meteor/local
, you’ll likely need to run it again.
Apart from that testing, I spent some time looking for a fix for this issue. It’s true that the cordova-build
context in 2.16 (at least initially) doesn’t include a package.json
file to use the resolutions
strategy. I tried using resolutions
, but it didn’t work as expected.
I could have tested more, but I decided to try it directly in the Meteor core. While debugging, I ran into some issues but haven’t found a quick solution yet.
I’ll discuss this with the team as this seems critical for Meteor 2.14 onward users, but I want to clarify a few things. In Meteor 2.x, we were limited by Node 14. To address Cordova issues (e.g., newer SDK requirements), Meteor upgraded Cordova to the latest versions, which require Node 16+. These upgrades worked well until now.
The sudden issue is due to a patch applied to a library used by Meteor 2.x directly and indirectly through other Cordova dependencies. Since the library targets Node 16, it uses a newer API on the patch. The challenge with a patch is that it installs the latest version automatically unless pinned, which isn’t a straightforward task at least so far.
Meteor 3 avoids these issues, making migration to the latest version essential, even though it can be challenging. Similar issues may arise in the future.