Gatsby Cloud - Migration to Yarn 3

I’m trying to build my Gatsby website on Gatsby Cloud by using Yarn 3 (3.5.0), and locally build works just fine. However, when I start building the blog, the following error message appears:

Error in “/usr/src/app/www/.yarn/virtual/…/gatsby-node”: Cannot find module ‘/usr/src/app/www/.yarn/virtual/…/gatsby-node.js’ imported from /usr/src/app/www/.yarn/unplugged/gatsby-virtual-09be85acda/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js

Anyone have an idea why this happening?

This is full log:

13:57:27 PM:
From https://github.com/Alxblsk/redone
 * branch            master     -> FETCH_HEAD
13:57:27 PM:
   3c5ad5f..a5c3d0e  master     -> origin/master
13:57:27 PM:
HEAD is now at a5c3d0e upgrade yarn 3
13:57:27 PM:
Already on 'master'
13:57:27 PM:
Your branch is up to date with 'origin/master'.
13:57:38 PM:
➤ YN0050: The --registry option is deprecated; prefer setting npmRegistryServer in your .yarnrc.yml file
13:57:39 PM:
➤ YN0000: ┌ Resolution step
13:57:39 PM:
➤ YN0002: │ @graphql-tools/graphql-tag-pluck@npm:7.5.2 [1ebb4] doesn't provide @babel/core (pd0d5d), requested by @babel/plugin-syntax-import-assertions
13:57:39 PM:
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p04159), requested by @parcel/fs
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (pafc98), requested by @parcel/workers
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p9cf70), requested by @parcel/cache
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p56cbe), requested by @parcel/package-manager
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide @babel/core (p1f728), requested by gatsby-plugin-image
➤ YN0060: │ alxblsk-redone@workspace:. provides react (p9e1a9) with version 18.2.0, which doesn't satisfy what gatsby and some of its descendants request
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide schema-dts (p7480c), requested by react-schemaorg
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide sharp (pd6be5), requested by gatsby-source-contentful
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide typescript (p0cf1c), requested by react-schemaorg
➤ YN0002: │ gatsby-plugin-feed@npm:5.9.0 [59e37] doesn't provide graphql (p3917f), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-image@npm:3.9.0 [59e37] doesn't provide graphql (p98ed1), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-page-creator@npm:5.9.0 [09be8] doesn't provide graphql (paf037), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-sharp@npm:5.9.0 [59e37] doesn't provide graphql (p9fec5), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide graphql (pfabb8), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide react (pccad5), requested by @contentful/rich-text-react-renderer
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide react-dom (pc632a), requested by @contentful/rich-text-react-renderer
➤ YN0002: │ gatsby-transformer-sharp@npm:5.9.0 [59e37] doesn't provide graphql (p203e8), requested by gatsby-plugin-utils
➤ YN
13:57:39 PM:
➤ YN0000: └ Completed in 0s 678ms
13:57:39 PM:
➤ YN0000: ┌ Fetch step
13:59:24 PM:
➤ YN0000: └ Completed in 1m 45s
13:59:24 PM:
➤ YN0013: │ 18 packages were already cached, 1476 had to be fetched
13:59:25 PM:
➤ YN0000: ┌ Link step
13:59:34 PM:
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
13:59:34 PM:
➤ YN0007: │ msgpackr-extract@npm:3.0.2 must be built because it never has been before or the last one failed
13:59:34 PM:
➤ YN0007: │ sharp@npm:0.31.3 must be built because it never has been before or the last one failed
13:59:34 PM:
➤ YN0007: │ core-js@npm:3.30.1 must be built because it never has been before or the last one failed
➤ YN0007: │ es5-ext@npm:0.10.62 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.30.1 must be built because it never has been before or the last one failed
13:59:34 PM:
➤ YN0007: │ contentful@npm:9.3.5 must be built because it never has been before or the last one failed
➤ YN0007: │ @parcel/watcher@npm:2.1.0 must be built because it never has been before or the last one failed
13:59:36 PM:
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   ---------------------------------------------------------------------------------------------
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   contentful.js - the contentful delivery API (library)
➤ YN0000: │ contentful@npm:9.3.5 STDOUT 
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   🚨 We have just released contentful.js v10 in Beta with enhanced ✨ TypeScript ✨ support! 🚨
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   You can check it out on npm under the beta-v10 tag (go to the "Versions" tab to find it). 
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   The migration guide and updated v10 README and can be found on the beta-v10 branch.
➤ YN0000: │ contentful@npm:9.3.5 STDOUT 
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   README: https://github.com/contentful/contentful.js/blob/beta-v10/README.md
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   MIGRATION GUIDE: https://github.com/contentful/contentful.js/blob/beta-v10/MIGRATION.md
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   BETA BRANCH: https://github.com/contentful/contentful.js/tree/beta-v10
➤ YN0000: │ contentful@npm:9.3.5 STDOUT   ---------------------------------------------------------------------------------------------
13:59:37 PM:
➤ YN0000: │ sharp@npm:0.31.3 STDOUT sharp: Using cached /home/gatsby/.npm/_libvips/libvips-8.13.3-linux-x64.tar.br
13:59:37 PM:
➤ YN0000: │ sharp@npm:0.31.3 STDOUT sharp: Integrity check passed for linux-x64
13:59:38 PM:
➤ YN0007: │ lmdb@npm:2.5.3 must be built because it never has been before or the last one failed
13:59:38 PM:
➤ YN0007: │ lmdb@npm:2.5.2 must be built because it never has been before or the last one failed
13:59:38 PM:
➤ YN0007: │ gatsby-telemetry@npm:4.9.0 must be built because it never has been before or the last one failed
13:59:38 PM:
➤ YN0007: │ gatsby-cli@npm:5.9.0 must be built because it never has been before or the last one failed
13:59:39 PM:
➤ YN0007: │ gatsby@npm:5.8.1 [59e37] must be built because it never has been before or the last one failed
13:59:39 PM:
➤ YN0000: └ Completed in 14s 689ms
13:59:40 PM:
➤ YN0000: Done with warnings in 2m 2s
13:59:40 PM:
To best use Gatsby Cloud, we are installing gatsby-plugin-gatsby-cloud to your site.
13:59:41 PM:
➤ YN0000: ┌ Resolution step
13:59:42 PM:
➤ YN0002: │ @graphql-tools/graphql-tag-pluck@npm:7.5.2 [1ebb4] doesn't provide @babel/core (pd0d5d), requested by @babel/plugin-syntax-import-assertions
13:59:42 PM:
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p04159), requested by @parcel/fs
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (pafc98), requested by @parcel/workers
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p9cf70), requested by @parcel/cache
➤ YN0002: │ @parcel/types@npm:2.8.3 doesn't provide @parcel/core (p56cbe), requested by @parcel/package-manager
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide @babel/core (p1f728), requested by gatsby-plugin-image
➤ YN0060: │ alxblsk-redone@workspace:. provides react (p9e1a9) with version 18.2.0, which doesn't satisfy what gatsby and some of its descendants request
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide schema-dts (p7480c), requested by react-schemaorg
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide sharp (pd6be5), requested by gatsby-source-contentful
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide typescript (p0cf1c), requested by react-schemaorg
➤ YN0002: │ alxblsk-redone@workspace:. doesn't provide webpack (p05089), requested by gatsby-plugin-gatsby-cloud
➤ YN0002: │ gatsby-plugin-feed@npm:5.9.0 [59e37] doesn't provide graphql (p3917f), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-image@npm:3.9.0 [59e37] doesn't provide graphql (p98ed1), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-page-creator@npm:5.9.0 [09be8] doesn't provide graphql (paf037), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-plugin-sharp@npm:5.9.0 [59e37] doesn't provide graphql (p9fec5), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide graphql (pfabb8), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide react (pccad5), requested by @contentful/rich-text-react-renderer
➤ YN0002: │ gatsby-source-contentful@npm:8.9.1 [59e37] doesn't provide react-dom (pc632a), requested by @contentful/rich-text-react-renderer
➤ YN0002: │ gatsby-transformer-sharp@npm:5.9.0 [59e37] doesn't provide graphql (p203e8), requested by gatsby-plugin-utils
➤ YN0002: │ gatsby@npm:5.8.1 [59e37] doesn't provide babel-eslint (p3ac9b), requested by eslint-config-react-app
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements  for details, where  is the six-letter p-prefixed code
13:59:42 PM:
➤ YN0000: └ Completed in 1s 538ms
13:59:42 PM:
➤ YN0000: ┌ Fetch step
13:59:43 PM:
➤ YN0013: │ 1492 packages were already cached, 7 had to be fetched
13:59:43 PM:
➤ YN0000: └ Completed in 0s 927ms
13:59:43 PM:
➤ YN0000: ┌ Link step
13:59:44 PM:
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
13:59:44 PM:
➤ YN0008: │ gatsby-telemetry@npm:4.9.0 must be rebuilt because its dependency tree changed
13:59:44 PM:
➤ YN0008: │ gatsby-cli@npm:5.9.0 must be rebuilt because its dependency tree changed
13:59:44 PM:
➤ YN0008: │ gatsby@npm:5.8.1 [59e37] must be rebuilt because its dependency tree changed
13:59:45 PM:
➤ YN0000: └ Completed in 1s 381ms
13:59:45 PM:
➤ YN0000: Done with warnings in 4s 158ms
13:59:46 PM:
npm
13:59:46 PM:
verb
13:59:46 PM:
 cli /home/gatsby/.nvm/versions/node/v18.16.0/bin/node /home/gatsby/.nvm/versions/node/v18.16.0/bin/npm
npm info using npm@9.5.1
npm info using node@v18.16.0
npm verb title npm install @gatsby-cloud-pkg/gatsby-inc-build-cli@2.0.4
npm verb argv "install" "--global" "@gatsby-cloud-pkg/gatsby-inc-build-cli@2.0.4" "--unsafe-perm" "--registry" "https://registry.npmjs.org/"
npm verb logfile logs-max:10 dir:/home/gatsby/.npm/_logs/2023-04-29T20_59_46_264Z-
13:59:46 PM:
npm
13:59:46 PM:
verb
13:59:46 PM:
 logfile /home/gatsby/.npm/_logs/2023-04-29T20_59_46_264Z-debug-0.log
13:59:46 PM:
npm
13:59:46 PM:
http fetch GET 200 https://registry.npmjs.org/@gatsby-cloud-pkg%2fgatsby-inc-build-cli 432ms (cache updated)
13:59:46 PM:

changed 1 package in 675ms
13:59:46 PM:
npm verb exit 0
npm info ok 
13:59:47 PM:
Node version v18.16.0
13:59:47 PM:
Gatsby version Usage Error: Unrecognized or legacy configuration settings found: pnpFile - run "yarn config -v" to see the list of settings supported in Yarn (in )
13:59:47 PM:
$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only]  ...
13:59:47 PM:
BUILDS
13:59:47 PM:
Setting gatsby to /usr/src/app/www/.yarn/unplugged/gatsby-virtual-09be85acda/node_modules/gatsby
13:59:48 PM:
info Running Inc Build CLI v2.0.4
13:59:51 PM:
verbose 3.514500046 Running build in "production" environment
13:59:53 PM:
success compile gatsby files - 2.393s
13:59:53 PM:
success load gatsby config - 0.163s
13:59:54 PM:
ERROR Error in "/usr/src/app/www/.yarn/__virtual__/gatsby-plugin-react-helmet-virtual-e154535df4/0/cache/gatsby-plugin-react-helmet-npm-6.9.0-8ca4180caf-570f855ea7.zip/node_modules/gatsby-plugin-react-helmet/gatsby-node": Cannot find module '/usr/src/app/www/.yarn/__virtual__/gatsby-plugin-react-helmet-virtual-e154535df4/0/cache/gatsby-plugin-react-helmet-npm-6.9.0-8ca4180caf-570f855ea7.zip/node_modules/gatsby-plugin-react-helmet/gatsby-node.js' imported from /usr/src/app/www/.yarn/unplugged/gatsby-virtual-09be85acda/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
13:59:54 PM:
Did you mean to import /usr/src/app/www/.yarn/__virtual__/gatsby-plugin-react-helmet-virtual-e154535df4/0/cache/gatsby-plugin-react-helmet-npm-6.9.0-8ca4180caf-570f855ea7.zip/node_modules/gatsby-plugin-react-helmet/gatsby-node.js?
13:59:54 PM:
  Error: Cannot find module '/usr/src/app/www/.yarn/__virtual__/gatsby-plugin-re  act-helmet-virtual-e154535df4/0/cache/gatsby-plugin-react-helmet-npm-6.9.0-8ca  4180caf-570f855ea7.zip/node_modules/gatsby-plugin-react-helmet/gatsby-node.js'   imported from /usr/src/app/www/.yarn/unplugged/gatsby-virtual-09be85acda/node  _modules/gatsby/dist/bootstrap/resolve-module-exports.js
13:59:54 PM:
  Did you mean to import /usr/src/app/www/.yarn/__virtual__/gatsby-plugin-react-  helmet-virtual-e154535df4/0/cache/gatsby-plugin-react-helmet-npm-6.9.0-8ca4180  caf-570f855ea7.zip/node_modules/gatsby-plugin-react-helmet/gatsby-node.js?
13:59:54 PM:
13:59:54 PM:
    [gatsby-virtual-09be85acda]/[gatsby]/src/services/initialize.ts:192:28
13:59:54 PM:
  
13:59:54 PM:
13:59:54 PM:
not finished load plugins - 0.331s
13:59:54 PM:
  
13:59:54 PM:
  - errors:399 new NodeError
13:59:54 PM:
    node:internal/errors:399:5
13:59:54 PM:
  
13:59:54 PM:
  - resolve:326 finalizeResolution
13:59:54 PM:
    node:internal/modules/esm/resolve:326:11
13:59:54 PM:
  
13:59:54 PM:
  - resolve:945 moduleResolve
13:59:54 PM:
    node:internal/modules/esm/resolve:945:10
13:59:54 PM:
  
13:59:54 PM:
  - resolve:1153 defaultResolve
13:59:54 PM:
  
13:59:54 PM:
    node:internal/modules/esm/resolve:1153:11
13:59:54 PM:
  - loader:163 nextResolve
13:59:54 PM:
    node:internal/modules/esm/loader:163:28
13:59:54 PM:
  
13:59:54 PM:
  - loader:838 ESMLoader.resolve
13:59:54 PM:
  
13:59:54 PM:
    node:internal/modules/esm/loader:838:30
13:59:54 PM:
  - loader:424 ESMLoader.getModuleJob
13:59:54 PM:
    node:internal/modules/esm/loader:424:18
13:59:54 PM:
  
13:59:54 PM:
  - loader:525 ESMLoader.import
13:59:54 PM:
    node:internal/modules/esm/loader:525:22
13:59:54 PM:
  
13:59:54 PM:
  - loader:1186 importModuleDynamically
13:59:54 PM:
    node:internal/modules/cjs/loader:1186:29
13:59:54 PM:
  
13:59:54 PM:
  - module:429 importModuleDynamicallyWrapper
13:59:54 PM:
    node:internal/vm/module:429:21
13:59:54 PM:
  
13:59:54 PM:
  - vm:106 importModuleDynamically
13:59:54 PM:
    node:internal/vm:106:46
13:59:54 PM:
  
13:59:54 PM:
  - esm_loader:35 importModuleDynamicallyCallback
13:59:54 PM:
    node:internal/process/esm_loader:35:14
13:59:54 PM:
  
13:59:54 PM:
  - resolve-module-exports.ts:219 resolveModuleExports
13:59:54 PM:
    [gatsby-virtual-09be85acda]/[gatsby]/src/bootstrap/resolve-module-exports.ts    :219:29
13:59:54 PM:
  
13:59:54 PM:
  - validate.ts:457 collatePluginAPIs
13:59:54 PM:
    [gatsby-virtual-09be85acda]/[gatsby]/src/bootstrap/load-plugins/validate.ts:    457:31
13:59:54 PM:
  
13:59:54 PM:
  - index.ts:43 loadPlugins
13:59:54 PM:
    [gatsby-virtual-09be85acda]/[gatsby]/src/bootstrap/load-plugins/index.ts:43:    42
13:59:54 PM:
  
13:59:54 PM:
  - initialize.ts:192 initialize

Hi @Alxblsk,

Could you please share your site ID so we can check in further depth from our end?

Hi @hrishikesh!

Netlify Site ID 13e8dd59-ba53-4d3b-8c93-5949eb5837fa, if it helps. But build itself is happening on Gatsby Cloud side.

Sorry for not being clear, I did mean the Gatsby site’s ID.

Hi @hrishikesh, it’s not obvious where that ID is stored but I assume that “4472a027-91a6-4e87-88aa-24b9f3a3f840” is the Gatsby Site ID you’re asking for.

Your 2 of the latest builds seem to have worked on Gatsby Cloud. The 3rd latest build, which is actually a failed build seems to have a completely different error.

I checked your latest CMS preview build which has failed, but that error seems to be because you’re using Node 13. At this stage, you should at least be using Node 18.

Hi @hrishikesh.

Thank you for looking into it. I had several more builds trying to restore functionality and switched to plain NPM. I’m not using Node 13 as you can see in these logs, they say “npm info using node@v18.16.0”. That failed build is 12th from the top.

I"m entirely confused as I can’t make it work with Yarn 3 thus I’m asking for help.