Skip to content
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

Could not find a copy of {pkg.name} to link in {location} #6285

Closed
tquetano-r7 opened this issue Aug 20, 2018 · 24 comments
Closed

Could not find a copy of {pkg.name} to link in {location} #6285

tquetano-r7 opened this issue Aug 20, 2018 · 24 comments
Assignees
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged

Comments

@tquetano-r7
Copy link

Do you want to request a feature or report a bug?

Report a bug.

What is the current behavior?

When doing yarn install, I get an linking error at the very end when yarn attempts to link packages under the hood, causing the overall install to fail.

If the current behavior is a bug, please provide the steps to reproduce.

This is consistently reproducible when running a simple yarn install. This was also present in version 1.9.2, but I waited to see if 1.9.4 would fix it, as it was a fast-follow.

Here is the (sanitized) error in trace in my yarn-error.log =>

Invariant Violation: could not find a copy of uuid to link in /home/tquetano/git/{repository}/node_modules/{package}/node_modules
      at invariant (/usr/lib/node_modules/yarn/lib/cli.js:1745:15)
      at PackageLinker.<anonymous> (/usr/lib/node_modules/yarn/lib/cli.js:49512:7)
      at Generator.next (<anonymous>)
      at step (/usr/lib/node_modules/yarn/lib/cli.js:92:30)
      at /usr/lib/node_modules/yarn/lib/cli.js:103:13
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

What is the expected behavior?

To install properly!

Please mention your node.js, yarn and operating system version.

Node => 8.11.4
Yarn => 1.9.4
OS => Manjaro Linux (Arch-based)

If there is more specific information I can provide to help, please let me know.

@ghost ghost assigned torifat Aug 20, 2018
@ghost ghost added the triaged label Aug 20, 2018
@fenduru
Copy link
Contributor

fenduru commented Aug 27, 2018

I'm also running into this - started happening randomly today (not related to upgrading yarn. previous yarn runs in the same folder had been successful).

Tried wiping the yarn cache manually to no avail

@brunolemos
Copy link

brunolemos commented Sep 28, 2018

I have this error pretty often. I use workspaces and have used yarn link on the package react-scripts.

I notice that sometimes I have to re-link the package because it got unlinked.

Part of the log:

yarn-error.log
Arguments: 
  /usr/local/bin/node /Users/brunolemos/.yarn/bin/yarn.js add apollo-server graphql

PATH: 
  /Users/brunolemos/.rbenv/shims:/Users/brunolemos/.rbenv/bin:/Users/brunolemos/.fastlane/bin:/Users/brunolemos/.yarn/bin:/Users/brunolemos/.config/yarn/global/node_modules/.bin:/usr/local/bin/mongo/bin:/usr/local/bin:/Users/brunolemos/.npm-global/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/brunolemos/Library/Android/sdk//bin:/Users/brunolemos/Library/Android/sdk/platform-tools/

Yarn version: 
  1.10.1

Node version: 
  8.11.4

Platform: 
  darwin x64

Trace: 
  Invariant Violation: could not find a copy of eslint to link in /Users/brunolemos/Projects/workstories/node_modules/web/node_modules/react-scripts/node_modules
      at invariant (/Users/brunolemos/.yarn/lib/cli.js:1736:15)
      at PackageLinker.<anonymous> (/Users/brunolemos/.yarn/lib/cli.js:45555:7)
      at Generator.next (<anonymous>)
      at step (/Users/brunolemos/.yarn/lib/cli.js:98:30)
      at /Users/brunolemos/.yarn/lib/cli.js:109:13
      at <anonymous>
      at process._tickCallback (internal/process/next_tick.js:188:7)

npm manifest: 
  {
    "name": "server",
    "version": "0.0.1",
    "dependencies": {
      "shared": "0.0.1"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
  # yarn lockfile v1
  
  
  "@babel/code-frame@7.0.0", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.0.0-beta.35":
    version "7.0.0"
    resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8"
    integrity sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==
    dependencies:
      "@babel/highlight" "^7.0.0"
  
  "@babel/code-frame@7.0.0-beta.44":
    version "7.0.0-beta.44"
    resolved "http://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9"
    integrity sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==
    dependencies:
      "@babel/highlight" "7.0.0-beta.44"
  
  "@babel/code-frame@7.0.0-beta.47":
    version "7.0.0-beta.47"
    resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.47.tgz#d18c2f4c4ba8d093a2bcfab5616593bfe2441a27"
    integrity sha512-W7IeG4MoVf4oUvWfHUx9VG9if3E0xSUDf1urrnNYtC2ow1dz2ptvQ6YsJfyVXDuPTFXz66jkHhzMW7a5Eld7TA==
    dependencies:
      "@babel/highlight" "7.0.0-beta.47"
  
  "@babel/core@7.0.0-beta.47":
    version "7.0.0-beta.47"
    resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.0.0-beta.47.tgz#b9c164fb9a1e1083f067c236a9da1d7a7d759271"
    integrity sha512-7EIuAX0UVnCgZ0E9tz9rFK0gd+aovwMA9bul+dnkmBQYLrJdas2EHMUSmaK67i1cyZpvgVvXhHtXJxC7wo3rlQ==
    dependencies:
      "@babel/code-frame" "7.0.0-beta.47"
      "@babel/generator" "7.0.0-beta.47"
      "@babel/helpers" "7.0.0-beta.47"
      "@babel/template" "7.0.0-beta.47"
      "@babel/traverse" "7.0.0-beta.47"
      "@babel/types" "7.0.0-beta.47"
      babylon "7.0.0-beta.47"
      convert-source-map "^1.1.0"
      debug "^3.1.0"
      json5 "^0.5.0"
      lodash "^4.17.5"
      micromatch "^2.3.11"
      resolve "^1.3.2"
      semver "^5.4.1"
      source-map "^0.5.0"
  
  "@babel/core@7.1.0", "@babel/core@^7.0.1", "@babel/core@^7.1.0":
    version "7.1.0"
    resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.1.0.tgz#08958f1371179f62df6966d8a614003d11faeb04"
    integrity sha512-9EWmD0cQAbcXSc+31RIoYgEHx3KQ2CCSMDBhnXrShWvo45TMw+3/55KVxlhkG53kw9tl87DqINgHDgFVhZJV/Q==
    dependencies:
      "@babel/code-frame" "^7.0.0"
      "@babel/generator" "^7.0.0"
      "@babel/helpers" "^7.1.0"
      "@babel/parser" "^7.1.0"
      "@babel/template" "^7.1.0"
      "@babel/traverse" "^7.1.0"
      "@babel/types" "^7.0.0"
      convert-source-map "^1.1.0"
      debug "^3.1.0"
      json5 "^0.5.0"
      lodash "^4.17.10"
      resolve "^1.3.2"
      semver "^5.4.1"
      source-map "^0.5.0"
  

  
  react-scripts@2.0.0:
    version "2.0.0"
    resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-2.0.0.tgz#baed13bd7e1592f6df8fb19a186671cdb0a92018"
    integrity sha512-lZNltuWfgD44Z+pyMU9iiZiuYhF1zJvXmFnuI5tKwgGuy7NuQpdD/fiO1UEO4VgtHZwFO84VvQoZGGnbm+8+2w==
    dependencies:
      "@babel/core" "7.1.0"
      "@babel/runtime" "7.0.0"
      "@svgr/webpack" "2.4.1"
      babel-core "7.0.0-bridge.0"
      babel-eslint "9.0.0"
      babel-jest "23.6.0"
      babel-loader "8.0.2"
      babel-plugin-named-asset-import "^0.2.0"
      babel-preset-react-app "^4.0.0"
      bfj "6.1.1"
      case-sensitive-paths-webpack-plugin "2.1.2"
      chalk "2.4.1"
      css-loader "1.0.0"
      dotenv "6.0.0"
      dotenv-expand "4.2.0"
      eslint "5.6.0"
      eslint-config-react-app "^3.0.0"
      eslint-loader "2.1.1"
      eslint-plugin-flowtype "2.50.1"
      eslint-plugin-import "2.14.0"
      eslint-plugin-jsx-a11y "6.1.1"
      eslint-plugin-react "7.11.1"
      file-loader "2.0.0"
      fs-extra "7.0.0"
      html-webpack-plugin "4.0.0-alpha.2"
      identity-obj-proxy "3.0.0"
      jest "23.6.0"
      loader-utils "1.1.0"
      mini-css-extract-plugin "0.4.3"
      optimize-css-assets-webpack-plugin "5.0.1"
      postcss-flexbugs-fixes "4.1.0"
      postcss-loader "3.0.0"
      postcss-preset-env "6.0.6"
      postcss-safe-parser "4.0.1"
      react-app-polyfill "^0.1.0"
      react-dev-utils "^6.0.0"
      resolve "1.8.1"
      sass-loader "7.1.0"
      style-loader "0.23.0"
      sw-precache-webpack-plugin "0.11.5"
      terser-webpack-plugin "1.1.0"
      thread-loader "1.2.0"
      url-loader "1.1.1"
      webpack "4.19.1"
      webpack-dev-server "3.1.9"
      webpack-manifest-plugin "2.0.4"
    optionalDependencies:
      fsevents "1.2.4"

@czycha
Copy link

czycha commented Oct 23, 2018

I'm seeing this also. I believe it has to do with peer-dependencies. In my case, I'm trying to install eslint-config-standard-preact which has a peer dependency of eslint >= 3.0.0. When I have eslint-config-standard-preact installed and run yarn add -D eslint, I receive errors similar to those above even though the version it is installing (5.7.0) matches that criteria. As pointed out on zouhir/eslint-config-standard-preact#11, you can install a specific version (even if it's effectively the same) and it'll work (ex. yarn add -D eslint@5.7.0).

@sibelius
Copy link

any workaround for this?

@sibelius
Copy link

this happened to me, when I have set eslint to be nohoist but we had different versions of eslint in some lerna packages when using yarn workspaces

@wangzuo
Copy link

wangzuo commented Dec 5, 2018

Removing nohoist help me get rid of this issue.

@gitowiec
Copy link

gitowiec commented Jan 18, 2019

I am heavly slowed down by this issue, Can't even do any progress (need new packages from npm registry). Our project is in monorepo and we are using workspaces, two of our private packages (packages/*) have nohoist. Removing nohoist does not do any good.
yarn --version 1.13.0

part of the error log is here
Arguments: 
  /home/marek/.nvm/versions/node/v8.11.4/bin/node /usr/share/yarn/lib/cli.js add uuid

PATH:
/home/marek/.nvm/versions/node/v8.11.4/bin:/home/marek/workspace/secret-project/node_modules/.bin:/home/marek/.yarn/bin:/home/marek/scripts:/home/marek/bin:/home/marek/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/marek/programs:/usr/local/jdk-9.0.4/bin

Yarn version:
1.13.0

Node version:
8.11.4

Platform:
linux x64

Trace:
Invariant Violation: could not find a copy of uuid to link in /home/marek/workspace/secret-project/node_modules/@storybook/addon-actions/node_modules
at invariant (/usr/share/yarn/lib/cli.js:2168:15)
at PackageLinker. (/usr/share/yarn/lib/cli.js:47979:7)
at Generator.next ()
at step (/usr/share/yarn/lib/cli.js:304:30)
at /usr/share/yarn/lib/cli.js:315:13
at
at process._tickCallback (internal/process/next_tick.js:188:7)

npm manifest:
{
"name": "payment-notification-sender",
"private": true,
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"workspaces": {
"nohoist": [
"**"
]
},
"scripts": {
"clean": "rimraf dist",
"copy-func-config": "cp ./src/function.source.json ./dist/function.json",
"build:prod": "yarn run clean && tsc && yarn run copy-func-config",
"build": "yarn run clean && tsc && yarn run copy-func-config",
"start": "yarn run build && concurrently --names "WATCH,HTTP" -k false -r "tsc -w" "sleep 3; yarn run func:start "",
"func:start": "func start"
},
"devDependencies": {
"@types/joi": "14.0.1",
"@types/node": "10.12.18",
"@types/nodemailer": "4.6.5",
"@types/react": "16.7.20",
"@types/react-dom": "16.0.11",
"concurrently": "4.1.0",
"rimraf": "2.6.3",
"tslint": "5.12.1",
"typescript": "3.2.2"
},
"dependencies": {
"azure-functions-ts-essentials": "1.3.2",
"bunyan": "1.8.12",
"bunyan-prettystream": "0.1.3",
"convict": "4.4.1",
"email-templates": "0.0.1",
"joi": "14.3.1",
"nodemailer": "5.1.1",
"react": "16.7.0",
"react-dom": "16.7.0"
}
}

yarn manifest:
No manifest

@gitowiec
Copy link

I found a stupid workaround, just specify version like this yarn add uuid@3.3.2 I did it following the yarn clean cache uuid but it could be enough by itself

@richardsimko
Copy link

richardsimko commented Mar 29, 2019

This started happening to me randomly with webpack in a repo where I've never used link. Yarn is now completely broken for me in that project.

@baflo
Copy link

baflo commented Sep 11, 2019

Was anybody able to tackle this problem eventually?

@verydanny
Copy link

verydanny commented Sep 13, 2019

I found out homebrew can fix these issues with brew doctor. In my case, I was writing a webpack library and yarn symlinked it. Brew found the symlink and purged it.

Woo

@msendlakowski
Copy link

Here is another concrete example:
https://github.com/msendlakowski/workspaces-test

The above will throw the error:

An unexpected error occurred: "could not find a copy of marko to link in /Users/msendlakowski/repos/workspaces-test-2/node_modules/package-a/node_modules".

But if I change the peerDependency in package-a from "marko": "^3 || ^4" to "marko": "^3" it works fine.

swashata added a commit to swashata/wp-webpack-script that referenced this issue Oct 27, 2019
Also remove peerDeps of eslint-config due to some yarn error. Will
come back at it later.

yarnpkg/yarn#6285
@speter9701

This comment has been minimized.

@jasonk
Copy link

jasonk commented Jun 11, 2020

I also ran into this in a monorepo, with a workspace that depended on pino and I kept getting the could not find a copy of pino to link to in.... What ended up working for me as a workaround was to yarn add -W pino in the root. I guess having that depended on at the top level as well caused it to be put in a place where it could be found for the later step...

@santiph
Copy link

santiph commented Jul 16, 2020

We had multiple major versions (v9 vs v10) of dependencies duplicated across our monorepo project.
Aligning them to the same version fixed the problem

@seeliang
Copy link

for my case, my walk-around is moved all devDependency to the root with yarn add -D -W.

@HomyeeKing
Copy link

I found a stupid workaround, just specify version like this yarn add uuid@3.3.2 I did it following the yarn clean cache uuid but it could be enough by itself

what's the theory behind this, it also works for me

@Andarist
Copy link

Just some random findings that maybe would allow somebody to pinpoint the issue. In my case, the problem was somehow caused by the fact that findNearestInstalledVersionOfPackage was called for a manifest containing ts-jest and binLoc equal to <root>/node_modules/vue-jest/node_modules but allLocations has contained only a path to <root>/node_modules/tsdx/node_modules/ts-jest. I have ts-jest defined as root's dependency and also as devDependency of most of my monorepo packages - additionally 2 of my dependencies depend on ts-jest (tsdx and vue-jest). After removing the tsdx completely from the project the issue has been fixed,

My bet would be that for some reason findNearestInstalledVersionOfPackage is called in my scenario before pkg._reference.locations has a chance to be fully populated correctly (sorting issue somewhere?) or that for some reason my hoisted dev/dependency (ts-jest) is not correctly populating pkg._reference.locations

@hyochan
Copy link

hyochan commented Jan 3, 2021

I found a stupid workaround, just specify version like this yarn add uuid@3.3.2 I did it following the yarn clean cache uuid but it could be enough by itself

Confirmed clearing caches work.

@Pines-Cheng
Copy link

Removing nohoist help me get rid of this issue.

@merceyz
Copy link
Member

merceyz commented Jan 13, 2021

Closing as fixed in v2

https://yarnpkg.com/getting-started/migration

@merceyz merceyz closed this as completed Jan 13, 2021
@merceyz merceyz added the fixed-in-modern This issue has been fixed / implemented in Yarn 2+. label Jan 13, 2021
@jacksteamdev
Copy link

This showed up for me when a child package had typescript in both devDependencies and peerDependencies.

I tried upgrading the dev dep, but didn't notice the peer dep and Yarn failed with the helpful error Could not find a copy.... Took 30 minutes to notice that peer dependency and bump it too. Then everything works no problem.

So check if the dependency is in multiple lists in the package.json.

josephfrazier added a commit to josephfrazier/eslint-config-careof that referenced this issue Jul 19, 2021
This should make it possible for `fc` to upgrade past v2, see https://github.com/careofvitamins/fc/pull/645#issuecomment-882796108

> Thanks for reviewing. I'm having some trouble resolving the merge conflict, will have to work on that and then re-request review.
>
> ```
> josephfrazier@C02WR4KZHTD615P:~/workspace/careof/fc/fulfillment$ yarn
> yarn install v1.22.10
> info Merge conflict detected in yarn.lock and successfully merged.
> [1/4] 🔍  Resolving packages...
> [2/4] 🚚  Fetching packages...
> info @ffmpeg-installer/darwin-arm64@4.1.5: The CPU architecture "x64" is incompatible with this module.
> info "@ffmpeg-installer/darwin-arm64@4.1.5" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/linux-arm@4.1.3: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/linux-arm@4.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/linux-arm@4.1.3: The CPU architecture "x64" is incompatible with this module.
> info @ffmpeg-installer/linux-arm64@4.1.4: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/linux-arm64@4.1.4" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/linux-arm64@4.1.4: The CPU architecture "x64" is incompatible with this module.
> info @ffmpeg-installer/linux-ia32@4.1.0: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/linux-ia32@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/linux-ia32@4.1.0: The CPU architecture "x64" is incompatible with this module.
> info @ffmpeg-installer/linux-x64@4.1.0: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/linux-x64@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/win32-ia32@4.1.0: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/win32-ia32@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
> info @ffmpeg-installer/win32-ia32@4.1.0: The CPU architecture "x64" is incompatible with this module.
> info @ffmpeg-installer/win32-x64@4.1.0: The platform "darwin" is incompatible with this module.
> info "@ffmpeg-installer/win32-x64@4.1.0" is an optional dependency and failed compatibility check. Excluding it from installation.
> [3/4] 🔗  Linking dependencies...
> warning " > styled-components@5.3.0" has unmet peer dependency "react-is@>= 16.8.0".
> warning " > eslint-config-careof@3.0.0" has incorrect peer dependency "eslint-plugin-jest@>= 24.3.6".
> warning " > mocha-multi@1.1.3" has incorrect peer dependency "mocha@>=2.2.0 <7.0.0".
> error An unexpected error occurred: "could not find a copy of eslint to link in /Users/josephfrazier/workspace/careof/fc/fulfillment/node_modules/eslint-config-careof/node_modules".
> info If you think this is a bug, please open a bug report with the information provided in "/Users/josephfrazier/workspace/careof/fc/fulfillment/yarn-error.log".
> info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
> josephfrazier@C02WR4KZHTD615P:~/workspace/careof/fc/fulfillment$
> ```
>
> Based on [yarnpkg/yarn#6285 (comment)](yarnpkg/yarn#6285 (comment)), it seems like this might be related to the fact that `eslint-config-careof` has `eslint` in multiple dependencies lists in the package.json: https://github.com/careofvitamins/eslint-config-careof/blob/b4725c781e6ef08a7f44264bea4a9a7b19d7fe92/package.json#L51-L67
>
> I'll try to see if I can get it working with a fork, then open a PR there.
@ical10
Copy link

ical10 commented Aug 30, 2021

I found a stupid workaround, just specify version like this yarn add uuid@3.3.2 I did it following the yarn clean cache uuid but it could be enough by itself

Confirmed working for @trivago/prettier-plugin-sort-imports package, but the order of the command is wrong.
I ran:
yarn cache clean @trivago/prettier-plugin-sort-imports

kassens added a commit to facebook/react that referenced this issue Dec 20, 2022
Hermes parser is the preferred parser for Flow code going forward. We
need to upgrade to this parser to support new Flow syntax like function
`this` context type annotations or `ObjectType['prop']` syntax.

Unfortunately, there's quite a few upgrades here to make it work somehow
(dependencies between the changes)

- ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin
tests depend on the older version and there's a [yarn
bug](yarnpkg/yarn#6285) that prevents
`devDependencies` and `peerDependencies` to different versions.
- Remove `eslint-config-fbjs` preset dependency and inline the rules,
imho this makes it a lot clearer what the rules are.
- Remove the turned off `jsx-a11y/*` rules and it's dependency instead
of inlining those from the `fbjs` config.
- Update parser and dependency from `babel-eslint` to `hermes-eslint`.
- `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions`
which now allows standalone type asserts, e.g. `(foo: number);`
- Bunch of globals added to the eslint config
- Disabled `no-redeclare`, seems like the eslint upgrade started making
this more precise and warn against re-defined globals like
`__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch
from node-fetch).
- Minor lint fixes like duplicate keys in objects.
github-actions bot pushed a commit to facebook/react that referenced this issue Dec 20, 2022
Hermes parser is the preferred parser for Flow code going forward. We
need to upgrade to this parser to support new Flow syntax like function
`this` context type annotations or `ObjectType['prop']` syntax.

Unfortunately, there's quite a few upgrades here to make it work somehow
(dependencies between the changes)

- ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin
tests depend on the older version and there's a [yarn
bug](yarnpkg/yarn#6285) that prevents
`devDependencies` and `peerDependencies` to different versions.
- Remove `eslint-config-fbjs` preset dependency and inline the rules,
imho this makes it a lot clearer what the rules are.
- Remove the turned off `jsx-a11y/*` rules and it's dependency instead
of inlining those from the `fbjs` config.
- Update parser and dependency from `babel-eslint` to `hermes-eslint`.
- `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions`
which now allows standalone type asserts, e.g. `(foo: number);`
- Bunch of globals added to the eslint config
- Disabled `no-redeclare`, seems like the eslint upgrade started making
this more precise and warn against re-defined globals like
`__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch
from node-fetch).
- Minor lint fixes like duplicate keys in objects.

DiffTrain build for [2b1fb91](2b1fb91)
[View git log for this commit](https://github.com/facebook/react/commits/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
acezard added a commit to cozy/cozy-libs that referenced this issue Feb 20, 2023
Having fixed versions broke yarn, see:
yarnpkg/yarn#6285
jerrydev0927 added a commit to jerrydev0927/react that referenced this issue Jan 5, 2024
Hermes parser is the preferred parser for Flow code going forward. We
need to upgrade to this parser to support new Flow syntax like function
`this` context type annotations or `ObjectType['prop']` syntax.

Unfortunately, there's quite a few upgrades here to make it work somehow
(dependencies between the changes)

- ~Upgrade `eslint` to `8.*`~ reverted this as the React eslint plugin
tests depend on the older version and there's a [yarn
bug](yarnpkg/yarn#6285) that prevents
`devDependencies` and `peerDependencies` to different versions.
- Remove `eslint-config-fbjs` preset dependency and inline the rules,
imho this makes it a lot clearer what the rules are.
- Remove the turned off `jsx-a11y/*` rules and it's dependency instead
of inlining those from the `fbjs` config.
- Update parser and dependency from `babel-eslint` to `hermes-eslint`.
- `ft-flow/no-unused-expressions` rule replaces `no-unused-expressions`
which now allows standalone type asserts, e.g. `(foo: number);`
- Bunch of globals added to the eslint config
- Disabled `no-redeclare`, seems like the eslint upgrade started making
this more precise and warn against re-defined globals like
`__EXPERIMENTAL__` (in rollup scripts) or `fetch` (when importing fetch
from node-fetch).
- Minor lint fixes like duplicate keys in objects.

DiffTrain build for [2b1fb91a55deb9b7b60452cb57184c2f182a42fd](facebook/react@2b1fb91)
[View git log for this commit](https://github.com/facebook/react/commits/2b1fb91a55deb9b7b60452cb57184c2f182a42fd)
@jannikschaper
Copy link

This showed up for me when a child package had typescript in both devDependencies and peerDependencies.

I tried upgrading the dev dep, but didn't notice the peer dep and Yarn failed with the helpful error Could not find a copy.... Took 30 minutes to notice that peer dependency and bump it too. Then everything works no problem.

So check if the dependency is in multiple lists in the package.json.

In my case, the version was the same in both devDependencies and peerDependencies ("webpack": "^5.89.0"). What worked was to remove the entry from peerDependencies entirely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-modern This issue has been fixed / implemented in Yarn 2+. triaged
Projects
None yet
Development

No branches or pull requests