Reputation: 1112
Running yarn workspace <nohoisted-package> start
gives error Unknown workspace "twitter-digester-frontend".
package.json
{
"name": "x",
"private": true,
"version": "1.0.0",
"workspaces": {
"packages": ["x-backend"],
"nohoist": ["x-frontend"]
},
"scripts": {
"backend": "yarn workspace x-backend",
"frontend": "yarn workspace x-frontend"
}
}
yarn workspace x-frontend start
fails with the error above ...Unknown workspace...
.yarn workspace x-backend start
works, though (i.e., works for non-nohoist
ed packages).Why does yarn workspace
fail with nohoist
ed packages?
I don't fully understand nohoist
. I'm mainly using it because Angular CLI in x-frontend
couldn't read node_modules
when not using nohoist
. I'm assuming it only means don't symlink packages - that's why I see no reason yarn workspace <nohoisted-package> <script>
shouldn't work.
Upvotes: 6
Views: 7910
Reputation: 5202
The first thing your root package.json
should contain an array of your workspaces:
{
...
"workspaces": [
"example",
"my-pkg-js"
]
}
The second thing to check is when you run yarn workspace <workspace> start
the <workspace>
stands for the name
in your package.json
in your package directory. For example:
yarn workspace package-name start
The name property in my-pkg-js/package.json
file should be something like:
{
...
"name": "package-name"
}
Upvotes: 16