[Case Study] Experience using on a medium sized codebase
See original GitHub issueWhat package is covered by this investigations?
No specific package were investigated. I’m mostly looking at the overall user experience of migrating to berry. We can go into more detail of specific issues later.
Describe the goal of the investigation
Investigate the usability of berry in the current state of the javascript ecosystem in a medium sized yarn workspace codebase. The codebase is ~3 years old with very little legacy code. All packages were updated about a week ago.
It contains the following apps which I expect berry to work:
- CRA website
- Gatsby website
- NextJS website
It also contains 2 react-native apps that I removed for the purpose of this test as it is not supported. It contains a nodejs / aws lambda backend that I will leave in the test as I’m not sure if it will be compatible or not.
Here’s the result of running cloc on the codebase:
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
TypeScript 1950 10649 4279 159079
JavaScript 45 11329 15774 19393
PO File 18 4082 6099 7892
ReasonML 25 329 38 3916
CSS 3 19 49 1022
SVG 37 0 0 497
JSON 1 0 0 355
Markdown 1 97 0 120
-------------------------------------------------------------------------------
SUM: 2080 26505 26239 192274
-------------------------------------------------------------------------------
Result of yarn list --depth=0
is around 3000 packages.
https://gist.github.com/janicduplessis/e676e01503e12028f1718b6c68683f82
Investigation report
Note that I did not go through the Migration guide on purpose before doing these tests to simulate what the average user would do. I’m only reading the getting started section on the website.
Test 1
Deleted all yarn related files and node_modules
to test like the project never used yarn before.
npm i -g yarn@berry
yarn --version
2.0.0-rc.27
yarn install
Internal Error: Assertion failed: The package should have been detected as part of the project
at Function.find (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:574360)
at async c.execute (/usr/local/lib/node_modules/yarn/bin/yarn.js:58:22393)
at async c.validateAndExecute (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:40434)
at async c.run (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533800)
at async c.runExit (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533934)
No idea what is going on here.
Test 2
Reinstall everything using yarn v1 and try to upgrade instead.
yarn policies set-version berry
Internal Error: Duplicate workspace name semver
at N.addWorkspace (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:576895)
at async N.setupWorkspaces (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:576595)
at async Function.find (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:574140)
at async c.execute (/usr/local/lib/node_modules/yarn/bin/yarn.js:58:43680)
at async c.validateAndExecute (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:40434)
at async c.run (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533800)
at async s.execute (/usr/local/lib/node_modules/yarn/bin/yarn.js:58:17806)
at async s.validateAndExecute (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:40434)
at async c.run (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533800)
at async c.runExit (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:533934)
Again not sure what is going in here. Let’s try to delete node_modules.
rm -rf ./**/node_modules
yarn policies set-version berry
Internal Error: th3rdwave@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions
at t.RunInstallPleaseResolver.getCandidates (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:863677)
at t.MultiResolver.getCandidates (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:41320)
at /usr/local/lib/node_modules/yarn/bin/yarn.js:36:581640
at /usr/local/lib/node_modules/yarn/bin/yarn.js:36:857805
at new Promise (<anonymous>)
at e.exports (/usr/local/lib/node_modules/yarn/bin/yarn.js:36:857787)
at i (/usr/local/lib/node_modules/yarn/bin/yarn.js:24:91764)
at /usr/local/lib/node_modules/yarn/bin/yarn.js:24:91837
at /usr/local/lib/node_modules/yarn/bin/yarn.js:24:91880
at new Promise (<anonymous>)
I guess yarn policies set-version berry
is for per project install and should not be needed. Let’s just try yarn install.
yarn install
# Lot of logs, keeping only errors with the log file content after
➤ YN0009: │ @th3rdwave/api@workspace:apps/api couldn't be built successfully (exit code 1, logs can be found here: /var/folders/dj/vrrkmv_s2mj85d4h4q_z2r640000gn/T/logfile-34631INNXZGGo4W4U.log)
# This file contains the result of Yarn building a package (@th3rdwave/api@workspace:apps/api)
# Script name: postinstall
File "bsconfig.json", line 1
Error: package @glennsl/bs-json not found or built
- Did you install it?
- If you did, did you run `bsb -make-world`?
➤ YN0009: │ @th3rdwave/ui@workspace:packages/ui [cc4f9] couldn't be built successfully (exit code 1, logs can be found here: /var/folders/dj/vrrkmv_s2mj85d4h4q_z2r640000gn/T/logfile-346312hAUOWVUPN22.log)
# This file contains the result of Yarn building a package (@th3rdwave/ui@virtual:cc4f92920029fa92436839b3963ce047f4d12c2a12308418f9454db2f644e4d407c859116dae93ca684930ee12d5bacc99d2fff7388a21dd22de0a29318f1240#workspace:packages/ui)
# Script name: install
Error: ENOENT: no such file or directory, open '/Users/janic/Developer/th3rdwave/.yarn/$$virtual/@th3rdwave-ui-virtual-e4a6203bb4/1/packages/ui/package.json'
Looks like api code won’t be compatible since it uses bucklescript and it doesn’t seem compatible currently. Also the serverless-webpack
package has an integration with yarn / npm for external modules and will surely not work since I know it relies on the node_modules directory.
I have no idea what the other error is.
Modules seem to have installed fine anyway and errors come from postinstall scripts so let’s try to run the CRA project.
yarn start
Failed to compile.
/Users/janic/Developer/th3rdwave/.yarn/cache/victory-brush-container-npm-34.0.0-9e1035c803-1.zip/node_modules/victory-brush-container/es/brush-helpers.js
Module not found: A package is trying to access another package without the second one being listed as a dependency of the first one
The error seem to come from a transitive dependency, but I have no idea how to edit my dependencies so I can’t hack around it. Will do some research on the error and come back to it later. Let’s try to run the gatsby project.
yarn start
ERROR #10123 CONFIG
We encountered an error while trying to load your site's gatsby-config. Please fix the error and try again.
Error: A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't
Required package: graphql (via "graphql/language/visitor")
Required by: apollo-utilities@virtual:46b3c3bb94b29f6356588c2db28662323c21629f 1b8227d147e0969f649d1d7eb00998238b0fa641c7c0eb1a5521d0cf59e7b79225d72f63254671 9598ade3aa#npm:1.3.3 (via /Users/janic/Developer/th3rdwave/.yarn/$$virtual/apo llo-utilities-virtual-ce5b80dbb0/0/cache/apollo-utilities-npm-1.3.3-8e73ac22c0 -1.zip/node_modules/apollo-utilities/lib/)
Require stack:
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/apollo-utilities-virtual-ce 5b80dbb0/0/cache/apollo-utilities-npm-1.3.3-8e73ac22c0-1.zip/node_modules/apol lo-utilities/lib/bundle.cjs.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/apollo-link-virtual-46b3c3b b94/0/cache/apollo-link-npm-1.2.13-6163d464c2-1.zip/node_modules/apollo-link/l ib/linkUtils.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/apollo-link-virtual-46b3c3b b94/0/cache/apollo-link-npm-1.2.13-6163d464c2-1.zip/node_modules/apollo-link/l ib/link.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/apollo-link-virtual-46b3c3b b94/0/cache/apollo-link-npm-1.2.13-6163d464c2-1.zip/node_modules/apollo-link/l ib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/apollo-link-retry-npm-2.2.15-3b d7c30ed5-1.zip/node_modules/apollo-link-retry/lib/retryLink.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/apollo-link-retry-npm-2.2.15-3b d7c30ed5-1.zip/node_modules/apollo-link-retry/lib/index.js
- /Users/janic/Developer/th3rdwave/apps/website/gatsby-config.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-virtual-9e0f15ba74/n ode_modules/gatsby/dist/bootstrap/get-config-file.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-virtual-9e0f15ba74/n ode_modules/gatsby/dist/bootstrap/load-themes/index.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-virtual-9e0f15ba74/n ode_modules/gatsby/dist/bootstrap/index.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-virtual-9e0f15ba74/n ode_modules/gatsby/dist/commands/develop.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-cli-npm-2.8.28-11886 b3838/node_modules/gatsby-cli/lib/create-cli.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-cli-npm-2.8.28-11886 b3838/node_modules/gatsby-cli/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/unplugged/gatsby-virtual-9e0f15ba74/n ode_modules/gatsby/dist/bin/gatsby.js
- .pnp.js:62900 Object.makeError
/Users/janic/Developer/th3rdwave/.pnp.js:62900:24
- .pnp.js:71747 resolveToUnqualified
/Users/janic/Developer/th3rdwave/.pnp.js:71747:35
- .pnp.js:71840 resolveRequest
/Users/janic/Developer/th3rdwave/.pnp.js:71840:27
- .pnp.js:71908 Object.resolveRequest
/Users/janic/Developer/th3rdwave/.pnp.js:71908:26
- .pnp.js:71138 Function.module_1.Module._resolveFilename
/Users/janic/Developer/th3rdwave/.pnp.js:71138:34
- .pnp.js:71023 Function.module_1.Module._load
/Users/janic/Developer/th3rdwave/.pnp.js:71023:40
- loader.js:1040 Module.require
internal/modules/cjs/loader.js:1040:19
- v8-compile-cache.js:159 require
[v8-compile-cache-npm-1.1.2-3d189dcf94-1.zip]/[v8-compile-cache]/v8-compile- cache.js:159:20
- bundle.cjs.js:58 Object.<anonymous>
[apollo-utilities-npm-1.3.3-8e73ac22c0-1.zip]/[apollo-utilities]/lib/bundle. cjs.js:58:16
- v8-compile-cache.js:178 Module._compile
[v8-compile-cache-npm-1.1.2-3d189dcf94-1.zip]/[v8-compile-cache]/v8-compile- cache.js:178:30
- loader.js:1171 Object.Module._extensions..js
internal/modules/cjs/loader.js:1171:10
- loader.js:1000 Module.load
internal/modules/cjs/loader.js:1000:32
- .pnp.js:71053 Function.module_1.Module._load
/Users/janic/Developer/th3rdwave/.pnp.js:71053:14
- loader.js:1040 Module.require
internal/modules/cjs/loader.js:1040:19
- v8-compile-cache.js:159 require
[v8-compile-cache-npm-1.1.2-3d189dcf94-1.zip]/[v8-compile-cache]/v8-compile- cache.js:159:20
- linkUtils.js:5 Object.<anonymous>
[apollo-link-npm-1.2.13-6163d464c2-1.zip]/[apollo-link]/lib/linkUtils.js:5:2 6
not finished open and validate gatsby-configs - 0.153s
Similar error, again in transitive dependencies. NextJS next.
yarn start
...
[ error ] /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/client/next-dev.js
Error: A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't
Required package: @babel/core (via "@babel/core")
Required by: @babel/plugin-proposal-optional-chaining@virtual:530e9bd66e722b3f9391f9b88851ee05c163aba7f0242b4fbad90c2cafcd3b1ed1e13da4426cafc064dc83f3c0e76511df3e86a7bea66354c0020efbc80f372a#npm:7.8.3 (via /Users/janic/Developer/th3rdwave/.yarn/$$virtual/@babel-plugin-proposal-optional-chaining-virtual-4c95e8940b/0/cache/@babel-plugin-proposal-optional-chaining-npm-7.8.3-11636bc994-1.zip/node_modules/@babel/plugin-proposal-optional-chaining/lib/)
Require stack:
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/@babel-plugin-proposal-optional-chaining-virtual-4c95e8940b/0/cache/@babel-plugin-proposal-optional-chaining-npm-7.8.3-11636bc994-1.zip/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/config/files/plugins.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/config/files/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/babel-loader-virtual-b40c2dae61/0/cache/babel-loader-npm-8.0.6-ccc68d8d38-1.zip/node_modules/babel-loader/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/build/webpack/loaders/next-babel-loader.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-1.zip/node_modules/loader-runner/lib/loadLoader.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-1.zip/node_modules/loader-runner/lib/LoaderRunner.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModule.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compiler.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/webpack.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/hot-reloader.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/next-dev-server.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/next.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/lib/start-server.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/cli/next-dev.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/bin/next
This one is actually coming from my code, let’s add "@babel/core": "^7.8.3",
to the project’s package.json and yarn install again.
yarn start
...
[ error ] /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/client/next-dev.js
Error: Cannot find module '@babel/preset-flow' from '/Users/janic/Developer/th3rdwave/apps/merchant-web'
at Array.map (<anonymous>)
I’m not using @babel/preset-flow
but lets try to add it to my package.json see if it helps.
yarn start
...
[ error ] ./src/components/App.tsx
Error: /Users/janic/Developer/th3rdwave/apps/merchant-web/src/components/App.tsx: A package is trying to access another package without the second one being listed as a dependency of the first one
Required package: @lingui/conf (via "@lingui/conf")
Required by: @lingui/macro@virtual:4df9b6e9bccb5b40df8244dc73f96a0fcdcf37509e681da7e8050d219415d88cc9117ce1fb402d7afca5eb5de65e37b17c97452dd32e8ad7f1c40cde88c01aaf#npm:3.0.0-7 (via /Users/janic/Developer/th3rdwave/.yarn/$$virtual/@lingui-macro-virtual-0bcb00f85e/0/cache/@lingui-macro-npm-3.0.0-7-d0b3c5d73e-1.zip/node_modules/@lingui/macro/)
Require stack:
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/@lingui-macro-virtual-0bcb00f85e/0/cache/@lingui-macro-npm-3.0.0-7-d0b3c5d73e-1.zip/node_modules/@lingui/macro/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/babel-plugin-macros-npm-2.8.0-451367d7e7-1.zip/node_modules/babel-plugin-macros/dist/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/config/files/plugins.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/config/files/index.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/@babel-core-npm-7.7.2-f988659b58-1.zip/node_modules/@babel/core/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/babel-loader-virtual-b40c2dae61/0/cache/babel-loader-npm-8.0.6-ccc68d8d38-1.zip/node_modules/babel-loader/lib/index.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/build/webpack/loaders/next-babel-loader.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-1.zip/node_modules/loader-runner/lib/loadLoader.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/loader-runner-npm-2.4.0-c414104c2f-1.zip/node_modules/loader-runner/lib/LoaderRunner.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModule.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/Compiler.js
- /Users/janic/Developer/th3rdwave/.yarn/cache/webpack-npm-4.41.2-efbe0580aa-1.zip/node_modules/webpack/lib/webpack.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/hot-reloader.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/next-dev-server.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/next.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/server/lib/start-server.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/cli/next-dev.js
- /Users/janic/Developer/th3rdwave/.yarn/$$virtual/next-virtual-56d64e00c9/0/cache/next-npm-9.2.0-8a025c2b15-1.zip/node_modules/next/dist/bin/next
Back with an error from a dependency. At this point I’m going to go read the migration guide see if I can find something there. Let’s also try to run the doctor tool see if it can give some useful information.
npx @yarnpkg/doctor
Result is here https://gist.github.com/janicduplessis/d71525ec8eb0692415465c73f5b4157c. TBH there is so much stuff that I’m not sure where to start. Almost everything is Unmet transitive peer dependency
.
Let’s go back to the first error in the CRA app. There is a section about it in the getting started guide https://yarnpkg.com/advanced/migration#a-package-is-trying-to-access-another-package-.
The error was
/Users/janic/Developer/th3rdwave/.yarn/cache/victory-brush-container-npm-34.0.0-9e1035c803-1.zip/node_modules/victory-brush-container/es/brush-helpers.js
Module not found: A package is trying to access another package without the second one being listed as a dependency of the first one
The error only mentions victory-brush-container so I will look there, however I’m not sure what is the “first” and the “second” dependency the error message talks about. To figure out what was going on I went and looked at the source for victory-brush-container and found it was missing a dependency on react-fast-compare https://github.com/FormidableLabs/victory/blob/master/packages/victory-brush-container/src/brush-helpers.js#L3.
According to the migration guide I can use https://yarnpkg.com/configuration/yarnrc#packageExtensions to fix those.
Let’s add a yarnrc file with
packageExtensions:
'victory-brush-container@*':
dependencies:
'react-fast-compare': '^2.0.4'
It did fix this error but a similar one in another victory package came up. I checked the result of yarn doctor and it doesn’t say anything about victory packages. At this point I would have to keep fixing one error, running yarn install and repeat until no errors are left. For now I will just remove victory from the codebase to get to the next step.
Same error again but with a different package react-native-safe-area-context
(this is my library lol). In this case it was missing a peer dep on react. Adding it to yarnrc.
This time for some reason it doesn’t work. This file mentionned in the error is https://github.com/th3rdwave/react-native-safe-area-context/blob/master/src/NativeSafeAreaView.web.tsx#L1-L2 and only includes imports to react and react-native. The library has peer deps on react native but is missing react https://github.com/th3rdwave/react-native-safe-area-context/blob/master/package.json#L41.
Adding the following entry in packageExtensions doesn’t fix the error after running yarn install and starting the project again.
'react-native-safe-area-context@*':
peerDependencies:
'react': '*'
At this point I’m kind of stuck. Could go down another rabbit hole in another project but I’m done for tonight. I might try to fix the missing peer dep in my library to see if it fixes the error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:5 (2 by maintainers)
Top GitHub Comments
I was having similar problems just trying yarn2 with a freshly initiated nextjs app.
My only solution: Go back to using good ol’ node_modules by adding
nodeLinker: node-modules
to .yarnrc.yml.Using yarn2 is definitely not a smooth transition at the moment. Hoping it can get there soon!
Thanks for the report, I’ve gone over this issue a few times since you opened it so it hasn’t been ignored. We’ve improved a lot of things since this was opened by fixing bugs both in Yarn and upstream so the experience should be a lot smoother now. The documentation has been updated as well and should make the migration easier.
If you’d like to give this another go so we can see what still needs improving that would be nice.
It’s hard to say what happened here and without a reproduction not much we can do.
You most likely had a workspaces pattern that included
node_modules
, we now ignore those folders (https://github.com/yarnpkg/berry/pull/1480 and https://github.com/yarnpkg/berry/pull/1513).It’s possible to set the version without running an install now so this is fixed (https://github.com/yarnpkg/berry/issues/1261).
Seems to be using native files which we now unplug automatically, however if they’re trying to read from the zip files then it wont work so you’ll either need to unplug whatever they’re trying to read or use node_modules.
We’ve improved the errors so they show all the info needed now (who, what, and where).
We’ve fixed the PnP issues in Next.js and both they and us have e2e tests that cover this now so that should prevent issues from happening in the future.