-
Notifications
You must be signed in to change notification settings - Fork 653
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
[Bug]: All capacitor commands fail with ERR_REQUIRE_ESM #5081
Comments
This issue needs more information before it can be addressed. In particular, the reporter needs to provide a minimal sample app that demonstrates the issue. If no sample app is provided within 15 days, the issue will be closed. |
I have added a reproduction repo: https://github.com/thomasakarlsen/capacitor-esm-bug |
Regarding the reproduction repo: There is something really weird going on with the dependencies here... |
Seems like deleting the yarn.lock file and then running Interestingly this works both for the reproduction repo and if you use |
Thanks for the issue, but it's an Ionic CLI issue, not a Capacitor issue, I've moved it to the appropriate repository. The problem is, as you have figured out by now, that something is installing Ionic CLI would need to be updated to support ESM dependencies for this to be fixed, but also some people mention that using yarn 4 also fixes the issue. |
I was facing this same issue:
I can confirm that yarn upgrade to yarn v4 did resolve the issue: |
Capacitor Version
(gathered after my temporary fix, see details below)
Latest Dependencies:
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
@capacitor/ios: 5.7.0
Installed Dependencies:
@capacitor/android: 5.7.0
@capacitor/ios: not installed
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
Other API Details
Platforms Affected
Current Behavior
When trying to run
ionic capacitor run android
for the first time in a fresh ionic app the following error appears when the ionic cli reaches the step where thiscapacitor init MyApp io.ionic.starter --web-dir dist
is run:Researching this issue I ran
yarn why string-width
which resulted in:Looking at the recent releases of
@vue/test-utils
I found that in versions2.4.1
and2.4.2
they updated their dependencies.By hard locking my version of
@vue/test-utils
to2.4.0
and performing a clean install by deleting myyarn.lock
file andnode_modules
followed byyarn install
I was able to runcapacitor init MyApp io.ionic.starter --web-dir dist
without any errors.Running
yarn why string-width
now results in:I do not know exactly what changed with the dependencies of
@vue/test-utils
after version2.4.0
but something there seems to cause yarn to disregard the manifest of@ionic/utils-terminal
and install major versions of some dependencies that are not supported.Expected Behavior
ionic capacitor run android
or evencapacitor init
works without any errorsThis is my output after locking
@vuejs/test-utils
to version2.4.0
:Project Reproduction
https://github.com/thomasakarlsen/capacitor-esm-bug
Additional Information
I had the same issue as ionic-team/capacitor#7126 and did some more digging to figure out why it was happening.
Based on the results of my debugging I am not sure if this is the right package to create the issue for, but it is the
capacitor init
command that fails. Let me know if the issue should be made elsewhere.For anyone else experiencing this issue the temporary solution seems to be locking
@vuejs/test-utils
to version2.4.0
(and doing a clean install of dependencies)The text was updated successfully, but these errors were encountered: