[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:
- Created 4 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 listfoo
but the same command from insidefoo
lists nothing. Deletingfoo/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.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 install
ing solves the trouble.