Hello everyone,
I’ve encountered a problem when attempting to add the Android platform to a Meteor project on a Windows 11 system. This is a fresh Meteor 3.0.1 installation by the way. Here are the details of the issue:
When running the command meteor add-platform android
, the following error occurs:
Error: Error: couldn't install npm package cordova-common@4.0.2: Command failed: C:\Windows\system32\cmd.exe /c C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\dev_bundle\bin\npm.cmd install cordova-common@4.0.2
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\dev_bundle\lib\node_modules\npm\bin\npm-cli.js'
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v20.15.1
After this error, attempting to run any meteor
command results in the following error:
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module '@meteorjs/reify/lib/runtime'
Require stack:
- C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\static-assets\server\runtime.js
- C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\tool-env\install-reify.js
- C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\tool-env\install-babel.js
- C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at require (node:internal/modules/helpers:179:18)
at enable (C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\static-assets\server\runtime.js:34:5)
at Object.<anonymous> (C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\tool-env\install-reify.js:12:48)
at Object.<anonymous> (C:\Users\rrd\AppData\Local\.meteor\packages\meteor-tool\3.0.1\mt-os.windows.x86_64\tools\tool-env\install-reify.js:15:3)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\rrd\\AppData\\Local\\.meteor\\packages\\meteor-tool\\3.0.1\\mt-os.windows.x86_64\\tools\\static-assets\\server\\runtime.js',
'C:\\Users\\rrd\\AppData\\Local\\.meteor\\packages\\meteor-tool\\3.0.1\\mt-os.windows.x86_64\\tools\\tool-env\\install-reify.js',
'C:\\Users\\rrd\\AppData\\Local\\.meteor\\packages\\meteor-tool\\3.0.1\\mt-os.windows.x86_64\\tools\\tool-env\\install-babel.js',
'C:\\Users\\rrd\\AppData\\Local\\.meteor\\packages\\meteor-tool\\3.0.1\\mt-os.windows.x86_64\\tools\\index.js'
]
}
Node.js v20.15.1
To resolve this issue temporarily, I have to reinstall Meteor (delete the whole .meteor folder).
Has anyone else experienced this issue?
This is a reproducible issue on my Windows env as well. We take a note to cover it on next patches.
Thank you for the report.
For get you unblocked, have you ever tried to use Meteor using WSL in Windows? It matches a UNIX environment where is working, and maybe could be a good movement in general to improve speed experience as well.
does meteor@2.7.4 has this kind of error ?
This issue seems specific to Meteor 3 on Windows, but it might affect the Meteor tool itself.
If you download the latest Meteor 3 tool using npx meteor@latest
on a Windows machine, it could impact any project managed with it, even Meteor 2 ones. This is just a guess, though, and not confirmed. Have you encountered the same error while using Meteor 2?
If you run into this problem, try removing your current Meteor installation and use npx meteor@2.16.0
. I believe it shouldn’t happen with that version assuming you get the problem.
can i walk you through what i did so far? i should mention that node js version i use is v20.17.0
npm install -g meteor --foreground-script
meteor create myapp
cd myapp
4.meteor
so far the web app works fine
when i try to use (meteor add-platform android) the error (missing modules) arises and after that no meteor command works
Yes, as mentioned in this forum post, that is the issue identified, and I am currently working on a fix for the next release, 3.0.4.
meteor:release-3.0.4
← meteor:windows-cordova-fix-dev
opened 03:24PM - 03 Oct 24 UTC
Context: https://github.com/meteor/meteor/issues/13250, [forum post #1](https://… forums.meteor.com/t/meteor-3-add-platform-android-breaks-meteor-installation-on-windows-11/61894/2), [forum post #2](https://forums.meteor.com/t/meteor-missing-modules/62354)
This PR continues solving Cordova development, this time on Windows, since it seems that latest Node versions produced a problem on the Meteor bundle that require dependencies to be locked.
## Issue
Using the `meteor add-platform android` command while setting up the Cordova project with the necessary npm dependencies corrupts the `dev_bundle`, removing critical dependencies. This can leave the entire Meteor installation unusable, requiring a complete reinstallation of Meteor. In practice, Cordova development does not work on the latest Meteor versions (it works on WSL, however).
After thorough debugging, I identified the issue. The problem is that the `dev_bundle` generated for Windows is missing the creation of the `package.json` context and the lock file in the dev_bundle's `lib/` directory. During the preparation of the Cordova project, it creates these files but removes existing critical dependencies (like npm) that are not locked, leading to the complete break of Meteor setup and the reported issues.
See the attached picture for clarification.
![image](https://github.com/user-attachments/assets/a8835f8b-d5d4-407b-b081-5668e7837989)
## Solution
We create a Meteor `dev_bundle` specifically for Unix and Windows systems. After reviewing the code, [I found that we explicitly removed these files](https://github.com/meteor/meteor/blob/devel/scripts/generate-dev-bundle.ps1#L381-L383) in earlier Meteor versions. However, newer Node versions require these dependencies to fix the dev_bundle. Likewise, for Unix, as part of Meteor 3, [we specifically copied these files](https://github.com/meteor/meteor/blob/devel/scripts/generate-dev-bundle.sh#L151-L154).
This PR simply updates the Windows scenario to align with the same expectation as Unix.
## Testing
The issue is solved:
![image](https://github.com/user-attachments/assets/fbefe5f7-3a01-4302-8928-87dfc68c4449)
However, I am performing tests to verify Cordova setup would work well now in raw Windows. I found another issue now with cordova running itself, so after adding proper Java and Android SDK envs, when running other error faced now ([error](https://github.com/user-attachments/assets/cfea1b6c-6e25-45fc-9e95-dc4129023ce0))
This PR is going to be a full review of Windows Cordova and ensure Cordova works as expected.
This PR will involve a complete review of Cordova on Windows, as additional issues have emerged. WSL functions well, but raw Windows has introduced problems in newer versions.
To resolve this issue and continue working on your Meteor project after meteor add-platform android
, please reinstall Meteor (npx meteor uninstall
then npx meteor
). Note that you cannot work with Cordova projects using raw Windows until the next version is released. If needed, please use WSL or a UNIX-like system. I will provide updates here once we address these issues.
Thank you for all your reports on this matter
1 Like
There has been a full review on Meteor Cordova when working in Windows environments. The Meteor Cordova has been fully reviewed for Windows environments. The issue mentioned, along with others found during testing, has been resolved. Documentation for Cordova on Windows has also been updated.
Release 3.0.4 is now available. Run meteor update --release 3.0.4
to start using it. Please consider reinstalling Meteor completely, as these changes involve dev_bundle modifications that may only be effective on clean installations. (npx meteor@latest uninstall
and then npx meteor
).
Related PRs
meteor:release-3.0.4
← meteor:windows-cordova-fix-dev
opened 03:24PM - 03 Oct 24 UTC
Context: https://github.com/meteor/meteor/issues/13250, https://github.com/meteo… r/meteor/issues/13250, [forum post #1](https://forums.meteor.com/t/meteor-3-add-platform-android-breaks-meteor-installation-on-windows-11/61894/2), [forum post #2](https://forums.meteor.com/t/meteor-missing-modules/62354)
This PR continues solving Cordova development, this time on Windows, since it seems that latest Node versions produced a problem on the Meteor bundle that require dependencies to be locked.
## Issue
Using the `meteor add-platform android` command while setting up the Cordova project with the necessary npm dependencies corrupts the `dev_bundle`, removing critical dependencies. This can leave the entire Meteor installation unusable, requiring a complete reinstallation of Meteor. In practice, Cordova development does not work on the latest Meteor versions (it works on WSL, however).
After thorough debugging, I identified the issue. The problem is that the `dev_bundle` generated for Windows is missing the creation of the `package.json` context and the lock file in the dev_bundle's `lib/` directory. During the preparation of the Cordova project, it creates these files but removes existing critical dependencies (like npm) that are not locked, leading to the complete break of Meteor setup and the reported issues.
See the attached picture for clarification.
![image](https://github.com/user-attachments/assets/a8835f8b-d5d4-407b-b081-5668e7837989)
## Solution
We create a Meteor `dev_bundle` specifically for Unix and Windows systems. After reviewing the code, [I found that we explicitly removed these files](https://github.com/meteor/meteor/blob/devel/scripts/generate-dev-bundle.ps1#L381-L383) in earlier Meteor versions. However, newer Node versions require these dependencies to fix the dev_bundle. Likewise, for Unix, as part of Meteor 3, [we specifically copied these files](https://github.com/meteor/meteor/blob/devel/scripts/generate-dev-bundle.sh#L151-L154).
This PR simply updates the Windows scenario to align with the same expectation as Unix.
## Testing
The issue is solved:
![image](https://github.com/user-attachments/assets/fbefe5f7-3a01-4302-8928-87dfc68c4449)
However, I am performing tests to verify Cordova setup would work well now in raw Windows. I found another issue now with cordova running itself, so after adding proper Java and Android SDK envs, when running other error faced now ([error](https://github.com/user-attachments/assets/cfea1b6c-6e25-45fc-9e95-dc4129023ce0))
This PR is going to be a full review of Windows Cordova and ensure Cordova works as expected.
meteor:release-3.0.4
← meteor:fix-cordova-windows
opened 01:47PM - 07 Oct 24 UTC
OSS-503
Context: https://github.com/meteor/meteor/issues/13250, https://githu… b.com/meteor/meteor/issues/13250, [forum post #1](https://forums.meteor.com/t/meteor-3-add-platform-android-breaks-meteor-installation-on-windows-11/61894/2), [forum post #2](https://forums.meteor.com/t/meteor-missing-modules/62354)
Continuation of https://github.com/meteor/meteor/pull/13388
This PR reviews the Windows Cordova setup to fix the existing issues.
Meteor Cordova apps run properly in Windows now.
![image](https://github.com/user-attachments/assets/3deea468-f74b-4965-a2c2-66e74e7ebf61)
## Pending
- [x] Update Cordova docs for Windows
1 Like