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

Project broken on Yarn v2 #3003

Closed
RDIL opened this issue Jun 27, 2020 · 13 comments
Closed

Project broken on Yarn v2 #3003

RDIL opened this issue Jun 27, 2020 · 13 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@RDIL
Copy link
Contributor

RDIL commented Jun 27, 2020

🐛 Bug Report

When on Yarn 2, I get this error when trying to run yarn start:

/workspace/Cherry/website/.pnp.js:28332
    throw firstError;
    ^

Error: A package is trying to access another package without the second one being listed as a dependency of the first one

Required package: @babel/runtime (via "@babel/runtime/helpers/interopRequireDefault")
Required by: react-loadable-ssr-addon@virtual:ebd7b9259ecd2093755e637a1fd861d705df40e70f047e72ef912a060f6f8b0d7d8b754ceeb087469fa51421c9654efe3ad7ba9d5fbe846f41f5175c740dcb64#npm:0.2.3 (via /workspace/Cherry/website/.yarn/$$virtual/react-loadable-ssr-addon-virtual-3a33825c47/0/cache/react-loadable-ssr-addon-npm-0.2.3-26d8c8d441-1.zip/node_modules/react-loadable-ssr-addon/lib/)

Require stack:
- /workspace/Cherry/website/.yarn/$$virtual/react-loadable-ssr-addon-virtual-3a33825c47/0/cache/react-loadable-ssr-addon-npm-0.2.3-26d8c8d441-1.zip/node_modules/react-loadable-ssr-addon/lib/index.js
- /workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/lib/commands/build.js
- /workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/lib/index.js
- /workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/bin/docusaurus.js
    at Object.makeError (/workspace/Cherry/website/.pnp.js:20077:24)
    at resolveToUnqualified (/workspace/Cherry/website/.pnp.js:28940:35)
    at resolveRequest (/workspace/Cherry/website/.pnp.js:29017:27)
    at Object.resolveRequest (/workspace/Cherry/website/.pnp.js:29085:26)
    at Function.module_1.Module._resolveFilename (/workspace/Cherry/website/.pnp.js:28315:34)
    at Function.module_1.Module._load (/workspace/Cherry/website/.pnp.js:28200:40)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/workspace/Cherry/website/.yarn/$$virtual/react-loadable-ssr-addon-virtual-3a33825c47/0/cache/react-loadable-ssr-addon-npm-0.2.3-26d8c8d441-1.zip/node_modules/react-loadable-ssr-addon/lib/index.js:3:30)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.module_1.Module._load (/workspace/Cherry/website/.pnp.js:28230:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/lib/commands/build.js:16:52) {
  code: 'MODULE_NOT_FOUND',
  pnpCode: 'UNDECLARED_DEPENDENCY',
  data: {
    request: '@babel/runtime/helpers/interopRequireDefault',
    issuer: '/workspace/Cherry/website/.yarn/$$virtual/react-loadable-ssr-addon-virtual-3a33825c47/0/cache/react-loadable-ssr-addon-npm-0.2.3-26d8c8d441-1.zip/node_modules/react-loadable-ssr-addon/lib/',
    issuerLocator: {
      name: 'react-loadable-ssr-addon',
      reference: 'virtual:ebd7b9259ecd2093755e637a1fd861d705df40e70f047e72ef912a060f6f8b0d7d8b754ceeb087469fa51421c9654efe3ad7ba9d5fbe846f41f5175c740dcb64#npm:0.2.3'
    },
    dependencyName: '@babel/runtime',
    candidates: [ 'react-loadable-ssr-addon', 'react-loadable', 'webpack' ]
  },
  requireStack: [
    '/workspace/Cherry/website/.yarn/$$virtual/react-loadable-ssr-addon-virtual-3a33825c47/0/cache/react-loadable-ssr-addon-npm-0.2.3-26d8c8d441-1.zip/node_modules/react-loadable-ssr-addon/lib/index.js',
    '/workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/lib/commands/build.js',
    '/workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/lib/index.js',
    '/workspace/Cherry/website/.yarn/$$virtual/@docusaurus-core-virtual-ebd7b9259e/0/cache/@docusaurus-core-npm-2.0.0-alpha.58-2f04b5f6f0-1.zip/node_modules/@docusaurus/core/bin/docusaurus.js'
  ]
}

Have you read the Contributing Guidelines on issues?

Yup

To Reproduce

Create D2 project with Yarn 2, then run yarn start

Expected behavior

It starts

Actual Behavior

See stacktrace above

Your Environment

  • Docusaurus version used: v2 beta (latest)
  • Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node 12.18.1 on Linux
  • Operating system and version (desktop or mobile): Gitpod

Reproducible Demo

(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)

@RDIL RDIL added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jun 27, 2020
@slorber
Copy link
Collaborator

slorber commented Jun 29, 2020

@SamChou19815 , seems related to your recent PR #3008

Any idea?

@slorber slorber added v2 and removed status: needs triage This issue has not been triaged by maintainers labels Jun 29, 2020
@SamChou19815
Copy link
Contributor

The fault is mostly on react-loadable-ssr-addon. It uses @babel/plugin-transform-runtime, so its emitted babel transpiled code will contain imports of @babel/runtime, but it doesn't declare @babel/runtime as a dependency. For now, using pnpMode: loose can unblock yourself, or you can add the package extensions.

@RDIL
Copy link
Contributor Author

RDIL commented Jun 30, 2020

I opened a PR to fix it.

@ylemkimon
Copy link
Contributor

There are other implicit dependencies:

(node:17057) [MODULE_NOT_FOUND] Error: react-loadable-ssr-addon tried to access @babel/runtime, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:17057) [MODULE_NOT_FOUND] Error: @docusaurus/core tried to access lodash.flatmap, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:17057) [MODULE_NOT_FOUND] Error: @docusaurus/core tried to access @docusaurus/preset-classic, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:17057) [MODULE_NOT_FOUND] Error: @docusaurus/plugin-content-docs tried to access chalk, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
(node:17057) [MODULE_NOT_FOUND] Error: @docusaurus/plugin-content-docs tried to access lodash, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

I'll send PRs to fix it.

@slorber
Copy link
Collaborator

slorber commented Aug 3, 2020

Hi,

Merged the PRs, is this issue still an issue? Can we close now?

@RDIL
Copy link
Contributor Author

RDIL commented Aug 3, 2020

@slorber waiting on downstream to fix.

@slorber
Copy link
Collaborator

slorber commented Aug 3, 2020

downstream?

@RDIL
Copy link
Contributor Author

RDIL commented Aug 3, 2020

react-loadable-ssr-addon

@slorber
Copy link
Collaborator

slorber commented Aug 3, 2020

@ylemkimon do you plan to do a pr to fix react-loadable-ssr-addon too ?

@RDIL
Copy link
Contributor Author

RDIL commented Aug 3, 2020

I already opened a PR for it, the maintainer doesn't want to merge it

@ylemkimon
Copy link
Contributor

themgoncalves/react-loadable-ssr-addon#22 is merged and included in the 0.3.0 release. I guess Dependabot will handle the bump?

@RDIL
Copy link
Contributor Author

RDIL commented Aug 4, 2020

I got it

@slorber
Copy link
Collaborator

slorber commented Aug 5, 2020

Closing, will be in next v2 release

@slorber slorber closed this as completed Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants