vuejs / apollo

🚀 Apollo/GraphQL integration for VueJS
http://apollo.vuejs.org
MIT License
6.02k stars 521 forks source link

Cannot build when using yarn 2 #928

Open ghost opened 4 years ago

ghost commented 4 years ago

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:

  1. Install yarn to any project with vue-apollo client yarn add -D yarn
  2. Run ./node_modules/.bin/yarn set version berry
  3. Run yarn
  4. Add webpack pnp-plugin
  5. Run project build script with yarn
  6. 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

DesselBane commented 3 years ago

Have you tried declaring the dependencies through the packageExtensions ? https://yarnpkg.com/configuration/yarnrc#packageExtensions