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] "workspace:./path/to/workspace" can not be resolved #1712

Closed
1 task done
JLHwung opened this issue Aug 18, 2020 · 1 comment · Fixed by #1722
Closed
1 task done

[Bug] "workspace:./path/to/workspace" can not be resolved #1712

JLHwung opened this issue Aug 18, 2020 · 1 comment · Fixed by #1722
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@JLHwung
Copy link
Sponsor Contributor

JLHwung commented Aug 18, 2020

  • I'd be willing to implement a fix

Describe the bug

"workspace:./path/to/workspace" can not be resolved when it is in root package.json.

To Reproduce

Reproduction
const { writeFile, mkdir } = require(`fs`).promises;

await mkdir("packages/example", { recursive: true });
await writeFile(
  "packages/example/package.json",
  `{
    "name": "@workspace/example"
}`
);

await expect(packageJsonAndInstall({
  workspaces: ["packages/*"],
  devDependencies: {
    "@workspace/example": "workspace:./packages/example"
  }
})).resolves.toBeTruthy();

Environment if relevant (please complete the following information):

  • Yarn version 2.1.1

Additional context

Found this issue in babel/babel#11962 (comment)

As a workaround, remove ./

"workspace:path/to/workspace"

or use

"workspace:*"
@JLHwung JLHwung added the bug Something isn't working label Aug 18, 2020
@yarnbot yarnbot added the reproducible This issue can be successfully reproduced label Aug 18, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Aug 18, 2020

This issue reproduces on master:

Error: expect(received).resolves.toBeTruthy()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install

➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0001: │ Error: @workspace/example@workspace:./packages/example: Workspace not found (@workspace/example@workspace:./packages/example)
    at Project.getWorkspaceByDescriptor (/github/workspace/packages/yarnpkg-core/sources/Project.ts:387:13)
    at WorkspaceResolver.getCandidates (/github/workspace/packages/yarnpkg-core/sources/WorkspaceResolver.ts:41:36)
    at MultiResolver.getCandidates (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:45:27)
    at MultiResolver.getCandidates (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:45:27)
    at map (/github/workspace/packages/yarnpkg-core/sources/Project.ts:695:46)
    at Array.map (<anonymous>)
    at Project.resolveEverything (/github/workspace/packages/yarnpkg-core/sources/Project.ts:684:90)
    at /github/workspace/packages/yarnpkg-core/sources/Project.ts:1498:7
    at StreamReport.startTimerPromise (/github/workspace/packages/yarnpkg-core/sources/StreamReport.ts:248:14)
    at Project.install (/github/workspace/packages/yarnpkg-core/sources/Project.ts:1481:5)
::endgroup::
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0.14s
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0ac41999f0.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:12:7)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)

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

Successfully merging a pull request may close this issue.

2 participants