question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Workspaces not linking

See original GitHub issue
  • I’d be willing to implement a fix

Describe the bug

Can’t add a workspace as a dependency to another. Not sure if I’m simply missing something but I’ve been through all the docs.

To Reproduce

Note: Sherlock prepare script link is broken in docs https://yarnpkg.com/advanced/scripts/actions/sherlock-prepare.js

Structure

- monorepo
  | - packages
    | - foo
    | - bar
yarn workspaces list --json

{"location":".","name":"monorepo"}
{"location":"packages/bar","name":"bar"}
{"location":"packages/foo","name":"foo"}

monorepo package.json

{
  "name": "base",
  "private": true,
  "workspaces": [
    "packages/*"
  ]
}

foo package.json

{
  "name": "foo",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "react": "^16.12.0",
    "bar": "workspace:1.0.0"
  }
}

bar package.json

{
  "name": "bar",
  "version": "1.0.0",
  "private": true
}
yarn workspace foo install

YN0000: ┌ Resolution step
➤ YN0001: │ Error: bar@workspace:1.0.0: Workspace not found (bar@workspace:1.0.0)
    at N.getWorkspaceByDescriptor (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:36:578058)
    at r.getCandidates (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:18:125280)
    at t.MultiResolver.getCandidates (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:24:41320)
    at t.MultiResolver.getCandidates (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:24:41320)
    at t.OverrideResolver.getCandidates (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:36:862484)
    at /Users/josh/n/lib/node_modules/yarn/bin/yarn.js:36:581640
    at /Users/josh/n/lib/node_modules/yarn/bin/yarn.js:36:857805
    at new Promise (<anonymous>)
    at e.exports (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:36:857787)
    at i (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:24:91764)
➤ YN0000: └ Completed in 0.01s
➤ YN0000: Failed with errors in 0.02s

Environment if relevant (please complete the following information):

  • OS: OS X
  • Node version: 13.7.0
  • Yarn version: 2.0.0-rc.27

Additional context

I’ve tried scoping, running a real package code, multiple iterations of the workspace: syntax,

Have also tried without the workspace syntax and simply run

yarn workspace foo add bar@1.0.0
➤ YN0000: ┌ Resolution step
➤ YN0001: │ HTTPError: barqweqwe@npm:1.0.0: Response code 404 (Not Found)
    at EventEmitter.<anonymous> (/Users/josh/n/lib/node_modules/yarn/bin/yarn.js:24:323118)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
➤ YN0000: └ Completed in 5.24s
➤ YN0000: Failed with errors in 5.24s

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

50reactions
warrenfalkcommented, Mar 5, 2020

I ran into the same symptom.

You might have had a foo/yarn.lock.

For my scenario, yarn workspaces list from the monorepo root would list foo but the same command from inside foo lists nothing. Deleting foo/yarn.lock fixed everything.

I don’t know if the OP’s issue was the same as mine.

Troubleshooting this wasn’t fun. It seems like something somewhere should have been warning about the yarn.lock being where it didn’t belong (i.e. that it was in a project that is listed as a workspace).

I don’t know how the yarn.lock got into the workspace project. I have not been able to come up with reproduction steps for that.

2reactions
cyrilchaponcommented, Feb 28, 2022

Confirmed yarn.lock leading to that.

This is especially true if you come here, starting with a non monorepo project then switching everything to monorepo. You’ll end up with non-composite yarn.lock inside subpackages. Removing it then yarn installing solves the trouble.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot issues accessing your WorkSpace from the ...
This error typically indicates that the WorkSpaces client can authenticate over port 443, but can't establish a streaming connection over UDP ...
Read more >
Dynamic Workspaces Not Working (#5232) · Issues - GitLab
I tried to disable all extensions, log out, and again login, but I am unable to find which extension is causing issue.
Read more >
Error while creating a new workspace "The working folder C ...
Hi,. I have 3 development environments in Azure with the same hostname DEV1. I configured workspace in the first machine. On the second...
Read more >
Installation issues - Google Workspace Admin Help
If that doesn't solve the problem, run fixmapi.exe. ... This error can occur after you change your Windows password. To fix the issue,...
Read more >
Workspaces not working - Illustrator UserVoice
What can we fix in Illustrator (desktop)? Vote or report a bug. ← Illustrator (Desktop) Bugs. Workspaces not working.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found