yarn
yarn copied to clipboard
[v1.22.19] - yarn workspaces installs same package (same version) twice and breaks afterwards
So I have a monerepo setup with a /packages
folder where I put all my private packages.
Today I created a new package as always and added external dependencies to this package like so:
yarn workspace my-package add form-data
As you can see I added the package form-data
to my package my-package
without any version constraints - in this case it added "form-data": "^4.0.0"
to my package.json.
The problem is, that the EXACT same package with the exact same version is already being used by another package in my "main package" (just called /app
), so the EXACT same package (form-data@^4.0.0
) is ALREADY INSTALLED in the <root>/node_modules
.
Now, for some reason, the exact same package is also installed into /packages/my-package/node_modules
.
The big problems occur afterwards - I can not make any changes anymore to any of my packages - I always end up with this error:
"ENOENT: no such file or directory, lstat '/Users/patrick/dev/my-monorepo/packages/my-package/node_modules/form-data'".
... as for some reason, at this point in time, this folder was already deleted by my yarn command.
What is going on here? Why is it even installing the SAME version of the SAME package into the "sub package node_modules folder" instead of using the package from the "root node_modules"?
Any updates on this? Did anybody else run into these problems and has a workaround?
I have this problem. Tried with --network-concurrency 1 still not fixing the problem.
I am using yarn v1.22.19