apollo
apollo copied to clipboard
Cannot build when using yarn 2
Describe the bug
When I'm trying to build my app with webpack after adding yarn as a package manager
yarn serve
I get the following errors in the console
ERROR in ./.yarn/$$virtual/apollo-utilities-virtual-7a551de862/0/cache/apollo-utilities-npm-1.3.3-8e73ac22c0-2.zip/node_modules/apollo-utilities/lib/bundle.esm.js
Module not found: 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:43f461c7bc5ff415623b481e4ad83d91ad0bd26c6fbb664d4f13c6d20ed73069f015be0b5c0f6e7fe5bf339862792c547b83608648c40b27cfb110b6528915ef#npm:1.3.3 (via ./.yarn/$$virtual/apollo-utilities-virtual-7a551de862/0/cache/apollo-utilities-npm-1.3.3-8e73ac22c0-2.zip/node_modules/apollo-utilities/lib/bundle.esm.js)
As soon as I reinstall the modules with npm install && npm run serve
everything works as expected.
To Reproduce Steps to reproduce the behavior:
- Install yarn to any project with
vue-apollo
clientyarn add -D yarn
- Run
./node_modules/.bin/yarn set version berry
- Run
yarn
- Add webpack pnp-plugin
- Run project build script with yarn
- Get the error
Expected behavior It should be buildable with yarn 2.
Versions vue: 2.6.11 vue-apollo: 3.0.3 apollo-boost: ^0.4.7
Have you tried declaring the dependencies through the packageExtensions ? https://yarnpkg.com/configuration/yarnrc#packageExtensions