Skip to content
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: cap run fails to work in a yarn 2+ workspace #6791

Closed
daniellacosse opened this issue Aug 4, 2023 · 6 comments · May be fixed by #7754
Closed

bug: cap run fails to work in a yarn 2+ workspace #6791

daniellacosse opened this issue Aug 4, 2023 · 6 comments · May be fixed by #7754
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android platform: ios

Comments

@daniellacosse
Copy link

daniellacosse commented Aug 4, 2023

Bug Report

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.2.2
  @capacitor/core: 5.2.2
  @capacitor/android: 5.2.2
  @capacitor/ios: 5.2.2

Installed Dependencies:

  @capacitor/android: 5.2.2 
  @capacitor/cli: 5.2.2
  @capacitor/core: 5.2.2
  @capacitor/ios: 5.2.2

[success] iOS looking great! 👌

Platform(s)

Developing on iOS and Android
Running on MacOS, M1 Pro, Ventura 13.5

Current Behavior

I have my capacitor project within a yarn 2+ PnP workspace. I'm running yarn workspace <package name> cap run ios and receiving the following error (PII in path redacted):

[error] SyntaxError: Unexpected token E in JSON at position 0
        at JSON.parse (<anonymous>)
        at getPlatformTargets
        (.../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/util/native-run.js:39:26)
        at async runIOS
        (.../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/ios/run.js:13:64)
        at async run
        (.../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/tasks/run.js:74:9)
        at async runCommand
        (.../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/tasks/run.js:61:13)
        at async
        .../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/index.js:125:9
        at async
        .../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/telemetry.js:26:13
        at async Command.<anonymous>
        (.../.yarn/cache/@capacitor-cli-npm-5.2.2-64c700d9bb-d23da7e05d.zip/node_modules/@capacitor/cli/dist/util/cli.js:12:13)

A similar thing happens with Android.

Expected Behavior

There should be a list of targets to load the app on.

Code Reproduction

I've got a WIP project here: https://github.com/Jigsaw-Code/outline-sdk/tree/outline-connectivity-app/x/outline-connectivity-app

Other Technical Details

npm --version output: I'm using yarn 3.6.1
node --version output: 18.16.1
pod --version output (iOS issues only): 1.12.1

Additional Context

I've noticed that we're calling native-run with the following:

async function runNativeRun(args, options = {}) {
    const p = (0, node_1.resolveNode)(__dirname, (0, path_1.dirname)('native-run/package'), 'bin/native-run');
    if (!p) {
        (0, errors_1.fatal)(`${colors_1.default.input('native-run')} not found.`);
    }
    return await (0, subprocess_1.runCommand)(p, args, options);
}

This doesn't seem like it would play very well with PnP? Not sure.

@daniellacosse
Copy link
Author

As a workaround, I've just been running the webserver and yarn workspaces <package name> cap open ios in a single command, and then starting the simulator from xcode.

@markemer markemer added the needs reproduction needs reproducible example to illustrate the issue label Aug 14, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Aug 14, 2023

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.
Please see the Contributing Guide for how to create a Sample App.
Thanks! Ionitron 💙

@Ionitron Ionitron added needs reply needs reply from the user and removed needs reply needs reply from the user labels Aug 14, 2023
@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Aug 15, 2023
@daniellacosse
Copy link
Author

daniellacosse commented Aug 23, 2023

Here's my example: https://github.com/Jigsaw-Code/outline-sdk/tree/outline-connectivity-app/x/outline-connectivity-app

It also seems to happen with android.

@Ionitron Ionitron removed the needs reply needs reply from the user label Aug 23, 2023
@daniellacosse daniellacosse changed the title bug: native run (cap run ios) fails to work in a yarn 2+ workspace bug: cap run fails to work in a yarn 2+ workspace Aug 23, 2023
@jcesarmobile
Copy link
Member

can you provide some steps to reproduce?
You have provided a massive repository with a "non standar" structure and no indications about where the capacitor app, where to run the commands, etc.

@jcesarmobile jcesarmobile added the needs reply needs reply from the user label Sep 12, 2023
@Ionitron
Copy link
Collaborator

It looks like this issue didn't get the information it needed, so I'll close it for now. If I made a mistake, sorry! I am just a bot.

Have a great day!
Ionitron 💙

@Ionitron Ionitron removed the needs reply needs reply from the user label Sep 28, 2023
@ionitron-bot
Copy link

ionitron-bot bot commented Oct 28, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs reproduction needs reproducible example to illustrate the issue platform: android platform: ios
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants