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 breaks with relative --cwd option #1056

Closed
1 task
kherock opened this issue Mar 10, 2020 · 0 comments · Fixed by #1134
Closed
1 task

[Bug] yarn breaks with relative --cwd option #1056

kherock opened this issue Mar 10, 2020 · 0 comments · Fixed by #1134
Labels
bug Something isn't working

Comments

@kherock
Copy link
Contributor

kherock commented Mar 10, 2020

  • I'd be willing to implement a fix

Describe the bug

Certain yarn 2.x subcommands seem to break when passing the --cwd option.

To Reproduce

Given the following hierarchy:

yarntest/
┣ .yarn/
┃ ┗ releases/
┃   ┗ yarn-berry.js
┣ subdir/
┃ ┗ workspace-b/
┃   ┗ package.json
┣ workspace-a/
┃ ┗ package.json
┣ .pnp.js
┣ .yarnrc.yml
┣ package.json
┗ yarn.lock

Attempting to pack each workspace from the the project root returns an error:

$ yarn --cwd workspace-a pack
Internal Error: ENOENT: no such file or directory, lstat '/home/user/yarntest/workspace-a/workspace-a'
    at Object.realpathSync (fs.js:1529:7)
    at /home/user/yarntest/.yarn/releases/yarn-berry.js:24:103298
    at async n (/home/user/yarntest/.yarn/releases/yarn-berry.js:24:102905)
$ yarn --cwd subdir/workspace-b pack
Internal Error: ENOENT: no such file or directory, lstat '/home/user/yarntest/subdir/workspace-b/subdir'
    at Object.realpathSync (fs.js:1529:7)
    at /home/user/yarntest/.yarn/releases/yarn-berry.js:24:103298
    at async n (/home/user/yarntest/.yarn/releases/yarn-berry.js:24:102905)

Environment if relevant (please complete the following information):

  • OS: Linux
  • Node version: 12.15.0
  • Yarn version: 2.0.0-rc.29

Additional context

Passing an absolute path succeeds, but only when the subdirectory is a workspace folder (which is
a separate issue #705).

@kherock kherock added the bug Something isn't working label Mar 10, 2020
@kherock kherock changed the title [Bug] yarn pack breaks with relative --cwd option [Bug] yarn breaks with relative --cwd option Mar 11, 2020
paul-soporan added a commit to paul-soporan/berry that referenced this issue Mar 30, 2020
arcanis pushed a commit that referenced this issue Apr 3, 2020
* fix(cli): fix --cwd

Fixes #1056.

* chore(release-workflow): set releases

* refactor(cli): make fix implementation use environment variables

* chore(release-workflow): update releases

* chore(release-workflow): fix releases
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

Successfully merging a pull request may close this issue.

1 participant