The problem in here seems to be an existing yarn.lock
file inside of one of the workspaces. Deleting it solves the problem.
More info:
Example: 3 workspaces: 2 create-react-app (app
, home
) and one shared component: (components
)
Inside the component
folder a lingering yarn.lock
file exists. Remove it.
Also check that:
- All your workspaces have
"private": true
in each of theirpackage.json
(same level asname
,private
,source
). - Check that you have added your workspaces inside a
"workspaces"
key in the mainpackage.json
- When you’re executing
yarn workspaces myworkspace
myworkspace
matches the name of your workspace in itspackage.json
. In my case, the name of the workspace inside thecomponents
folder is called@schon/components
, so I need to address it asyarn worksapces @schon/components
instead.
CLICK HERE to find out more related problems solutions.