-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to install dependencies in workspace: expected workspace package to exist #7807
Comments
Experiencing the same behavior when trying to add a dependency to a workspace package:
Similar details
|
Experiencing the same issue with node@10:
I found a (temporary) workaround by running the policies feature of yarn in my repo:
which basically means:
|
Also seeing this in Yarn 1.21.1. I can reproduce the error in my repository when running |
Encountering this as well: error An unexpected error occurred: "expected workspace package to exist for \"string-length\"". When trying to add an unrelated dependency inside one on my workspace packages Tried ▶ yarn --version
1.21.1 |
Same error here: $ yarn workspace @scope/web add ramda
error An unexpected error occurred: "expected workspace package to exist for \"chalk\"".
info If you think this is a bug, please open a bug report with the information provided in "/home/user/projects/web/apps/web/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
error Command failed.
Exit code: 1 Adding yarn-error.log
|
I have been experiencing the same issues since After updating to
Downgrading to I should point out that these problems only occur on one project, which is a monorepo that uses |
Same experience as @raspo |
I didn't want to have to downgrade yarn since it comes from my package manager so I used npx as a terrible workaround.
|
Also get this 1.17 through 1.22. It seems to be a handful of packages - starting with
lerna.json
|
I am also getting this regression any news? |
same here, monorepo and yarn interactive upgrade on mac
|
As a temp solution use something |
|
was running into issues installing dependencies yarnpkg/yarn#7807
I just had the same problem on a monorepo Lerna + Yarn (v1.22). Solved re-creating the |
This looks like a duplicate of #7734. |
Running into this for @storybook/api. @nerdyman's workaround appears to have worked for me in the interim. |
Newer versions have a workspace issue See yarnpkg/yarn#7807
it's work for me |
I had this same problem and although deleting So the solution was to use More info here: https://classic.yarnpkg.com/en/docs/cli/policies#toc-policies-set-version |
So the solution to this problem is downgrading |
@remorses apologies if I incorrectly read sarcasm in your reply. I haven't seen anyone submit a PR to fix this in 1.x. It's possible that, in other issues, folks have submitted fixes for this or other bugs that have been rejected, and that would make me sad. If there are abundant PRs for 1.x that are being ignored, I would hope that the maintainers would welcome community members who want to help maintain 1.x. Without PRs and maintenance from the community, it's hard to fault anyone for wanting to focus on their active development branch. |
The above suggestion of using npx works
The suggestion to rename the root The issue was introduced with Yarn 1.19.2. Using Yarn 1.19.1 works fine. Looking at what was introduced in this version here. The part of the code that mentions This change was introduced with this PR on May 20, 2019 which was addressing the following `Dependencies not symlinked when root package depends on older version of packages from npm, reported here. Based on the code here, it is forcing us to list the package we want in the workspace as well as the root. It escape the hoisting logic which results in the package not being placed into the child workspace. |
Not sure why this repo is not archived at this point. |
What worked for me:
|
I was able to overcome this using a similar workaround: |
I'm getting the same error:
Any help? EDIT 1: I tried deleting all node_modules directories in my EDIT 2: I ran |
Removing the yarn.lock and the node modules, and then doing an yarn install again, solved it to me |
For me removing duplicates from yarn.lock always solves the problem, here is the package i am using: npx yarn-deduplicate yarn.lock |
it is easy! you can use yarn@3.5.1 For monorepos, the best version of Yarn to use is 3.5. corepack enable
corepack prepare yarn@latest --activate |
We have an nx monorepo. I get Removing the root
|
I recently upgraded lerna to 7.4.2 and nx to 17.1.3 and started seeing this error. None of the workarounds posted helped me because the package requires yarn 1.22.21+ (The engine "yarn" is incompatible with this module. Expected version ">=1.22.21". Got "1.19.0”). The only workaround I could find was manually adding the package to the package.json and running yarn, which seemed to work for me. |
看看你的 package.json |
was running into issues installing dependencies yarnpkg/yarn#7807
In my case I noticed that in two of the workspaces I had a newer version of a package than in the root package.json (specifically I had @storybook/react@^7.2.1 in the workspaces and @storybook/react@6.3.4 in the root). When I changed these to all have the same version and removed the yarn.lock file it started working. I was able to identify this package by searching for the package name in the error (webpack in this case) in the yarn-error.log. |
Through experimentation, I suspect that this may be caused by a version conflict between your workspace dependency version and the root version though what specifically is causing it may depend on your circumstance. In one case, I was able to address duplicates in the yarn.lock. In another case, I realized that the library was redundant in the root package. In both cases, different workspaces held different versions (I'm in the process of upgrading them) |
For me adding the package in package.json manually and then running |
Yearly reminder THAT THIS PROJECT IS ABANDONED |
try deleting |
Newer versions have a workspace issue See yarnpkg/yarn#7807
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
yarn install
fails with:The error started occurring after upgrading yarn to
1.19
and it still persists in latest stable version1.21.1
Similar errors can be observed in #7797 and #7734
If the current behavior is a bug, please provide the steps to reproduce.
The error can be reproduced when installing dependencies in https://github.com/callstack/haul
git clone git@github.com:callstack/haul.git
cd haul
yarn install
What is the expected behavior?
yarn install
should successfully install dependencies.Please mention your node.js, yarn and operating system version.
12.14.1
/13
(reproducible on both)1.21.1
The text was updated successfully, but these errors were encountered: