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] yarn-path in .yarnrc is not set using standardized path separators #291

Closed
MLoughry opened this issue Jul 9, 2019 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@MLoughry
Copy link

MLoughry commented Jul 9, 2019

Describe the bug

When running yarn policies set-version berry in a repository on a Windows machine, this will set the yarn-path using Windows path separators, like so:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


lastUpdateCheck 1562702253233
yarn-path ".yarn\\releases\\yarn-berry.js"

Then, when you attempt to run yarn on a *nix machine, you get an error:

Error: Cannot find module '/home/vsts/work/1/s/.yarn\releases\yarn-berry.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

To Reproduce

Migrate a repository to yarn berry on a Windows machine. You can see the .yarnrc immediately, or run it on a *nix machine to see the resulting error.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment if relevant (please complete the following information):

  • OS: Windows
  • Node version 12.4.0
  • Yarn version 2.0.0

Additional context

This seems like a simple enough bug that I was going to submit my own PR, but I can't seem to find where this is set. Is this bug in the release version of yarn?

@MLoughry MLoughry added the bug Something isn't working label Jul 9, 2019
@arcanis
Copy link
Member

arcanis commented Jul 10, 2019

Hm interesting - this particular fix should be done in the v1 trunk, since it's the one that generates and reads the yarn-path field in this situation (right before shelling out to the local binary):

https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/policies.js#L158

@paul-soporan
Copy link
Member

This isn't a problem anymore (after yarnpkg/yarn#7931), so I'm going to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants