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

Does not work with Yarn 2 Plug'n'Play (Berry) #295

Closed
AaronBuxbaum opened this issue Apr 8, 2021 · 7 comments
Closed

Does not work with Yarn 2 Plug'n'Play (Berry) #295

AaronBuxbaum opened this issue Apr 8, 2021 · 7 comments

Comments

@AaronBuxbaum
Copy link
Contributor

AaronBuxbaum commented Apr 8, 2021

When trying to use percy exec with Yarn 2, the following is thrown:

[MODULE_NOT_FOUND] Error Plugin: @percy/cli: Qualified path resolution failed - none of the candidates can be found on the disk.

this is likely because you can't necessarily make the assumption that repos will be available, for example: node_modules/@percy/cli-exec/dist/hooks/init won't be correct because they're not under a node_modules folder. However, even with this, you could theoretically install each plugin and yarn unplug it.

I think a biggest problem comes because it can't seem to find the index.js file when pointed at a folder:

Source path: /Users/aaron/Work/web/node_modules/@percy/cli-exec/dist/commands/exec
    Rejected candidate: 
    /Users/aaron/Work/web/node_modules/@percy/cli-exec/dist/commands/exec
    Rejected candidate: 
    /Users/aaron/Work/web/node_modules/@percy/cli-exec/dist/commands/exec.js
    Rejected candidate: 
    /Users/aaron/Work/web/node_modules/@percy/cli-exec/dist/commands/exec.json
    Rejected candidate: 
    /Users/aaron/Work/web/node_modules/@percy/cli-exec/dist/commands/exec.node

Any suggestions here?

@Robdel12
Copy link
Contributor

Robdel12 commented Apr 8, 2021

Hey @AaronBuxbaum! Are you using Yarn 2s Plug n Play?

@AaronBuxbaum
Copy link
Contributor Author

Hey @AaronBuxbaum! Are you using Yarn 2s Plug n Play?

Yup. Currently in loose mode, though hopefully eventually in strict mode

@Robdel12
Copy link
Contributor

Robdel12 commented Apr 8, 2021

Gotcha! Unless the changes are minimal, I don't think it's something we'll adopt.

@Robdel12 Robdel12 closed this as completed Apr 8, 2021
@Robdel12 Robdel12 changed the title Does not work with Yarn 2 (Berry) Does not work with Yarn 2 Plug'n'Play (Berry) Apr 8, 2021
@wwilsman
Copy link
Contributor

wwilsman commented Apr 8, 2021

I wanted to add that we depend on OCLIF, which itself does not yet support PnP: oclif/config#171

Perhaps you may have some luck with Yarn's pnpify?

@AaronBuxbaum
Copy link
Contributor Author

Perhaps you may have some luck with Yarn's pnpify?

this would be fine, but this is actually what I'm doing above. If I don't use pnpify, I get an error about being unable to find package.json files

@AaronBuxbaum
Copy link
Contributor Author

AaronBuxbaum commented Apr 8, 2021

While we're waiting for oclif/config, I've done the following:

  1. Submitted a ping on the PR: Fix plugins not being found when no node_modules exists oclif/config#171
  2. Set the package in package.json under resolutions: "@oclif/config": "https://github.com/TPHRyan/oclif-config",
  3. Set missing packageExtensions:
  '@percy/cli@*':
    dependencies:
      '@oclif/command': '*'
      '@oclif/errors': '*'
  1. Run the following: yarn add -D @yarnpkg/pnpify @oclif/plugin-help @percy/cli @percy/cli-build @percy/cli-config @percy/cli-exec @percy/cli-snapshot @percy/cli-upload @percy/config
  2. Run percy through pnpify: yarn pnpify percy exec ...

This is less than ideal because I have all of these dependencies of percy directly in my own package.json, but it's not a huge deal. Hopefully it can get resolved eventually. But it does work, for now at least!

@JonnyPickard
Copy link

@AaronBuxbaum thanks for this workaround. I'd managed to get to step 4 on my own but didn't think to run Percy through pnpify 👍🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants