I have a repo set up to use yarn workspaces. However, when I try to run a script from workspace a
, I get an error: Unknown workspace "a".
I also cannot run the script directly from folder a
.
cd a
yarn log
yarn run v1.22.19
error Command "log" not found.
My top-level package.json
declares workspaces a
and b
:
{
"name": "vue-tsc-repro",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build",
"preview": "vite preview"
},
"workspaces": [
"a",
"b"
],
"dependencies": {
"vue": "^3.4.21"
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vue-tsc": "^2.0.26"
}
}
In folder a
, I have the following package.json:
{
"name": "a",
"version": "0.0.0",
"private": true,
"scripts": {
"log": "echo hello"
}
}
It appears yarn
simply isn’t recognizing the workspaces I’ve added. When I try to add dependencies to a/package.json
they are not installed.
I am using yarn version 1.22.19.
What am I missing?