Yarn missing dependencies somehow, fails to build

System Information
  • Strapi Version: 4.12.0
  • Operating System: OSX Mojave 10.14.6
  • Database: MariaDB 11.0.2
  • Node Version: 18.14.0 (via NVM)
  • NPM Version: 9.4.1
  • Yarn Version: 3.6.1

Similar to this post: Yarn build or yarn develop error every installed plugin on strapi

My first Strapi project, first time using Yarn, only a bit of experience with Node… so any pointers are appreciated.

I get the following errors when running yarn or yarn build:

➤ YN0002: │ @strapi/design-system@npm:1.8.2 [6ecef] doesn't provide @codemirror/view (p2d491), requested by @uiw/react-codemirror
➤ YN0002: │ @strapi/design-system@npm:1.8.2 [f9036] doesn't provide @codemirror/view (pd9f3d), requested by @uiw/react-codemirror
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react (p5ac83), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react (p45185), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react (p07e75), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-dom (p5cfaf), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-dom (pcdf1f), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-dom (p46397), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-router-dom (p3ff13), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-router-dom (p84d20), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide react-router-dom (p0b660), requested by @strapi/plugin-upload
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide styled-components (p875a8), requested by @strapi/plugin-content-type-builder
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide styled-components (pb6a15), requested by @strapi/plugin-email
➤ YN0002: │ @strapi/strapi@npm:4.12.0 doesn't provide styled-components (pc6e3c), requested by @strapi/plugin-upload
➤ YN0002: │ babel-plugin-styled-components@npm:2.1.4 [b7b2c] doesn't provide @babel/core (p28bd5), requested by @babel/plugin-syntax-jsx
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react (pe9108), requested by @strapi/plugin-color-picker
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react (p7df36), requested by @strapi/plugin-i18n
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react (p46d1c), requested by @strapi/plugin-users-permissions
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-dom (pa8a59), requested by @strapi/plugin-color-picker
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-dom (p62bce), requested by @strapi/plugin-i18n
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-dom (p562cd), requested by @strapi/plugin-users-permissions
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-router-dom (p6d886), requested by @strapi/plugin-color-picker
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-router-dom (pce372), requested by @strapi/plugin-i18n
➤ YN0002: │ leaguefinder@workspace:. doesn't provide react-router-dom (pea124), requested by @strapi/plugin-users-permissions
➤ YN0002: │ leaguefinder@workspace:. doesn't provide styled-components (pc1e31), requested by @strapi/plugin-color-picker
➤ YN0002: │ leaguefinder@workspace:. doesn't provide styled-components (p75a70), requested by @strapi/plugin-i18n
➤ YN0002: │ leaguefinder@workspace:. doesn't provide styled-components (pb04ce), requested by @strapi/plugin-users-permissions
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code

If I run yarn explain peer-requirements p5ac83 for example,

➤ YN0000: @strapi/strapi@npm:4.12.0 doesn't provide react, breaking the following requirements:

➤ YN0000: @emotion/react@npm:11.11.1 [822b0]                             → >=16.8.0                      ✘
➤ YN0000: @emotion/use-insertion-effect-with-fallbacks@npm:1.0.1 [7e6f3] → >=16.8.0                      ✘
➤ YN0000: @floating-ui/react-dom@npm:2.0.1 [50b2f]                       → >=16.8.0                      ✘
➤ YN0000: @radix-ui/react-arrow@npm:1.0.3 [b737f]                        → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-collection@npm:1.0.3 [91291]                   → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-compose-refs@npm:1.0.1 [9b1c4]                 → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-context@npm:1.0.1 [56cff]                      → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-direction@npm:1.0.1 [91291]                    → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-dismissable-layer@npm:1.0.4 [50b2f]            → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-dropdown-menu@npm:2.0.5 [50b2f]                → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-focus-guards@npm:1.0.1 [91291]                 → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-focus-scope@npm:1.0.3 [50b2f]                  → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-id@npm:1.0.1 [56cff]                           → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-menu@npm:2.0.5 [56cff]                         → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-popper@npm:1.1.2 [91291]                       → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-portal@npm:1.0.3 [91291]                       → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-presence@npm:1.0.1 [91291]                     → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-primitive@npm:1.0.3 [9b1c4]                    → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-roving-focus@npm:1.0.4 [91291]                 → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-slot@npm:1.0.2 [34067]                         → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-callback-ref@npm:1.0.1 [9b1c4]             → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-controllable-state@npm:1.0.1 [56cff]       → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-escape-keydown@npm:1.0.3 [9b1c4]           → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-layout-effect@npm:1.0.1 [9553e]            → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-previous@npm:1.0.1 [d67dc]                 → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-rect@npm:1.0.1 [b737f]                     → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-use-size@npm:1.0.1 [b737f]                     → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @radix-ui/react-visually-hidden@npm:1.0.3 [d67dc]              → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: @strapi/design-system@npm:1.8.2 [f9036]                        → ^17.0.0 || ^18.0.0            ✘
➤ YN0000: @strapi/helper-plugin@npm:4.12.0 [f9036]                       → ^17.0.0 || ^18.0.0            ✘
➤ YN0000: @strapi/icons@npm:1.8.2 [f9036]                                → ^17.0.0 || ^18.0.0            ✘
➤ YN0000: @strapi/plugin-content-type-builder@npm:4.12.0 [526e9]         → ^17.0.0 || ^18.0.0            ✘
➤ YN0000: @strapi/ui-primitives@npm:1.8.2 [50b2f]                        → ^17.0.0 || ^18.0.0            ✘
➤ YN0000: @uiw/react-codemirror@npm:4.21.7 [50b2f]                       → >=16.8.0                      ✘
➤ YN0000: formik@npm:2.4.2 [ab251]                                       → >=16.8.0                      ✘
➤ YN0000: react-helmet@npm:6.1.0 [f9036]                                 → >=16.3.0                      ✘
➤ YN0000: react-intl@npm:6.4.1 [f9036]                                   → ^16.6.0 || 17 || 18           ✘
➤ YN0000: react-query@npm:3.39.3 [ab251]                                 → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-redux@npm:8.1.1 [f9036]                                  → ^16.8 || ^17.0 || ^18.0       ✘
➤ YN0000: react-remove-scroll-bar@npm:2.3.4 [291bc]                      → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-remove-scroll@npm:2.5.6 [50b2f]                          → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-remove-scroll@npm:2.5.5 [91291]                          → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-select@npm:5.7.0 [ab251]                                 → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-side-effect@npm:2.1.2 [1cd41]                            → ^16.3.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-style-singleton@npm:2.2.1 [291bc]                        → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: react-transition-group@npm:4.4.5 [822b0]                       → >=16.6.0                      ✘
➤ YN0000: use-callback-ref@npm:1.3.0 [291bc]                             → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: use-isomorphic-layout-effect@npm:1.1.2 [822b0]                 → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: use-sidecar@npm:1.1.2 [291bc]                                  → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘
➤ YN0000: use-sync-external-store@npm:1.2.0 [0effe]                      → ^16.8.0 || ^17.0.0 || ^18.0.0 ✘

➤ YN0000: Note: these requirements start with @strapi/plugin-content-type-builder@npm:4.12.0 [526e9]

It used to be that I could still build the admin UI despite the warnings, until today. The last thing I installed is @strapi/plugin-color-picker and it’s possible that this is the straw that broke the camel’s back. Now yarn develop will fail to build the admin UI with never-ending missing dependency errors, which seem like they all stem from those missing package warnings.

What’s strange is all those dependencies are declared inside .cache/package.json (and maybe elsewhere? I don’t know the Strapi architecture). I’ve run yarn cache clean several times and there’s no change.

What a cluster****. Maybe my OS is just too old, or there’s a conflict somewhere with nvm - but I’m running all this as the same user.

I decided to create a new project directory and just migrate my data types and database to it, only once again yarn went crazy:

Creating a quickstart project.
Creating a new Strapi application at /parent/project.
Creating files.
Error while installing dependencies:

 Keep trying!

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentioned in the installation errors and try to run the following command:

cd /parent/project && yarn install

So we enter the dir and run yarn install

Usage Error: The nearest package directory (/parent/project) doesn't seem to be part of the project declared in /parent.

- If /parent isn't intended to be a project, remove any yarn.lock and/or package.json file there.
- If /parent is intended to be a project, it might be that you forgot to list parent/project in its workspace configuration.
- Finally, if /parent is fine and you intend parent/project to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

So that’s all inaccurate – there is no package.json or yarn.lock file in the parent directory where I ran the command (and there shouldn’t be), and there’s no yarn.lock file in the project directory, but there is a package.json and the rest of the quickstart files…

I’m giving up on yarn for now and trying the next project with npm only.

Okay I went with npm, did a custom install using the existing database, installed the plugin, and copied over my src folder from the old project… and we are up and running again, seemingly without any issues.