Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependency error when using yarn berry #38543

Closed
2 tasks done
Ryong-E opened this issue Sep 12, 2023 · 2 comments
Closed
2 tasks done

dependency error when using yarn berry #38543

Ryong-E opened this issue Sep 12, 2023 · 2 comments
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Ryong-E
Copy link

Ryong-E commented Sep 12, 2023

Preliminary Checks

Description

I'm using Gatsby.
I'm trying to apply yarn berry with
yarn set version berry -> yarn install -> yarn start
I get the following message

Shouldn't we add @babel/plugin-transform-react-jsx dependencies inside the gatsby package?

Module build failed (from ./.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js):
Error: gatsby tried to access @babel/plugin-transform-react-jsx, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @babel/plugin-transform-react-jsx
Required by: gatsby@virtual:b52fa53de345840734aae13ce2112e264c9c70f255dbf4dbbe590b66a273e3a608cef5a98a6664d5f19abae28bc38af11947443e08b9765a7c73168a49cefe43#npm:5.12.4
(via /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/)

Require stack:
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader-helpers.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/webpack.config.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/start-server.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/start-webpack-server.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/index.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/services.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/index.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/commands/develop-process.js
- /Users/handongryong/Documents/my-blog/.cache/tmp-10721-x2b4Th6OmSHi
    at Function.require$$0.Module._resolveFilename (/Users/handongryong/Documents/my-blog/.pnp.cjs:32870:13)
    at resolve (node:internal/modules/cjs/helpers:109:19)
    at forEach (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader-helpers.ts:171:33)
    at Array.forEach (<anonymous>)
    at prepareOptions (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader-helpers.ts:169:45)
    at Object.config (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader.ts:118:25)
    at Object.<anonymous> (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.
zip/node_modules/babel-loader/lib/index.js:130:42)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.
zip/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.zip/node_modu
les/babel-loader/lib/index.js:4:194)



  ModuleBuildError: Module build failed (from ./.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js):
  Error: gatsby tried to access @babel/plugin-transform-react-jsx, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
  Required package: @babel/plugin-transform-react-jsx
  Required by: gatsby@virtual:b52fa53de345840734aae13ce2112e264c9c70f255dbf4dbbe590b66a273e3a608cef5a98a6664d5f19abae28bc38af11947443e08b9765a7c73168a49cefe43#npm:5.12.
  4 (via /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/)
  Require stack:
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader-helpers.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/webpack.config.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/start-server.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/start-webpack-server.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/index.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/services.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/index.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/commands/develop-process.js
  - /Users/handongryong/Documents/my-blog/.cache/tmp-10721-x2b4Th6OmSHi

Reproduction Link

https://github.com/Ryong-E/HanDongRyong.com

Steps to Reproduce

  1. delete node_modules, yarn.lock
  2. open terminal yarn set version berry - yarn install - yarn start

...

Expected Result

Build error due to lack of package in dependency

Actual Result

Error occurred

Module build failed (from ./.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js):
Error: gatsby tried to access @babel/plugin-transform-react-jsx, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: @babel/plugin-transform-react-jsx
Required by: gatsby@virtual:b52fa53de345840734aae13ce2112e264c9c70f255dbf4dbbe590b66a273e3a608cef5a98a6664d5f19abae28bc38af11947443e08b9765a7c73168a49cefe43#npm:5.12.4
(via /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/)

Require stack:
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader-helpers.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/webpack.config.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/start-server.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/start-webpack-server.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/index.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/services.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/index.js
- /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/commands/develop-process.js
- /Users/handongryong/Documents/my-blog/.cache/tmp-10721-x2b4Th6OmSHi
    at Function.require$$0.Module._resolveFilename (/Users/handongryong/Documents/my-blog/.pnp.cjs:32870:13)
    at resolve (node:internal/modules/cjs/helpers:109:19)
    at forEach (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader-helpers.ts:171:33)
    at Array.forEach (<anonymous>)
    at prepareOptions (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader-helpers.ts:169:45)
    at Object.config (/Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/src/utils/babel-loader.ts:118:25)
    at Object.<anonymous> (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.
zip/node_modules/babel-loader/lib/index.js:130:42)
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.
zip/node_modules/babel-loader/lib/index.js:3:103)
    at _next (/Users/handongryong/Documents/my-blog/.yarn/__virtual__/babel-loader-virtual-d0062b6743/0/cache/babel-loader-npm-8.3.0-a5239d7ed2-d48bcf9e03.zip/node_modu
les/babel-loader/lib/index.js:4:194)



  ModuleBuildError: Module build failed (from ./.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js):
  Error: gatsby tried to access @babel/plugin-transform-react-jsx, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
  Required package: @babel/plugin-transform-react-jsx
  Required by: gatsby@virtual:b52fa53de345840734aae13ce2112e264c9c70f255dbf4dbbe590b66a273e3a608cef5a98a6664d5f19abae28bc38af11947443e08b9765a7c73168a49cefe43#npm:5.12.
  4 (via /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/)
  Require stack:
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader-helpers.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/babel-loader.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/webpack.config.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/utils/start-server.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/start-webpack-server.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/services/index.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/services.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/state-machines/develop/index.js
  - /Users/handongryong/Documents/my-blog/.yarn/unplugged/gatsby-virtual-db6b693683/node_modules/gatsby/dist/commands/develop-process.js
  - /Users/handongryong/Documents/my-blog/.cache/tmp-10721-x2b4Th6OmSHi

Environment

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
    Yarn: 3.6.3 - ~/.nvm/versions/node/v18.12.0/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
  Browsers:
    Chrome: 116.0.5845.187
    Safari: 16.5.2
  npmGlobalPackages:
    gatsby-cli: 5.7.0

Config Flags

No response

@Ryong-E Ryong-E added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 12, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 12, 2023
@pieh
Copy link
Contributor

pieh commented Jan 3, 2024

https://github.com/Ryong-E/HanDongRyong.com/blob/f5a03cd1c1d692af197cdfd43022595d39f09b5c/gatsby-node.js#L9 this probably should be name: require.resolve('@babel/plugin-transform-react-jsx'), - by default @babel/preset-react is used which includes that plugin

@Ryong-E
Copy link
Author

Ryong-E commented Jan 13, 2024

That plug-in is causing a dependency problem. Thank you.

@Ryong-E Ryong-E closed this as completed Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
2 participants