Open psydvl opened 4 years ago
any update on this issue?
I just ran into this issue as well. Is there a workaround or is the Ionic cli currently unusable with Yarn Berry?
In case it helps anyone, I got a workaround going by temporarily changing the package manager back to npm in ~/.ionic/config.json
, then running ionic capacitor add ios
to add the iOS project. After that, I switched back to yarn and ran yarn install
in the app directory (which removed the node modules folder). I was not able to run ionic capacitor open ios
after that, but yarn capacitor open ios
seems to work. That made me wonder if running yarn capacitor add ios
would have worked, but I'm past that now :)
-- UPDATE --
Turns out, my original approach didn't work because it seemed to use Capacitor v2 to create the iOS project, which didn't work because it was expecting files to be in the node_modules folder, which doesn't exist. My package.json file had Capacitor v3 listed, which doesn't use npm packages for native files. So I removed the iOS folder created by my original command and ran yarn capacitor add ios
and that worked: I was able to open the project in Xcode and was able to build and run it in the simulator. Whew...
Any update here?
2 years later...
A pull request was made to fix this issue...
So, it seems nobody care about yarn berry, if you are facing this problem, simply create a patch file on .yarn/patches/@ionic-cli-npm-6.20.1-53fb01ed2a.patch
, the content should be:
diff --git a/lib/utils/npm.js b/lib/utils/npm.js
index 640e88d400afdeef85b3859e02eaad97f5c29b9f..4443315d2fbfeeca941ca9cb1cf8b7a474b8170c 100644
--- a/lib/utils/npm.js
+++ b/lib/utils/npm.js
@@ -42,7 +42,7 @@ async function pkgManagerArgs(npmClient, options) {
vocab = { run: 'run', install: 'i', bareInstall: 'i', uninstall: 'uninstall', dedupe: 'dedupe', rebuild: 'rebuild', global: '-g', save: '--save', saveDev: '-D', saveExact: '-E', nonInteractive: '', lockFileOnly: '--package-lock-only' };
break;
case 'yarn':
- vocab = { run: 'run', install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', rebuild: 'install', global: '', save: '', saveDev: '--dev', saveExact: '--exact', nonInteractive: '--non-interactive', lockFileOnly: '' };
+ vocab = { run: 'run', install: 'add', bareInstall: 'install', uninstall: 'remove', dedupe: '', rebuild: 'install', global: '', save: '', saveDev: '--dev', saveExact: '--exact', nonInteractive: '', lockFileOnly: '' };
if (options.global) { // yarn installs packages globally under the 'global' prefix, instead of having a flag
installerArgs.push('global');
}
Then, change your version code of @ionic/cli
in package.json
with: patch:@ionic/cli@npm:6.20.1#.yarn/patches/@ionic-cli-npm-6.20.1-53fb01ed2a.patch
.
run yarn
to apply the patch, your @ionic/cli
will play well with Yarn Berry, just like a magic.
Good luck and have a nice day.
Description:
ionic start
command broken with Yarn v2 (aka berry).Steps to Reproduce:
Or even:
Output:
My
ionic info
:Other Information: Migration guide: https://yarnpkg.com/advanced/migration