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

[Bug] Yarn doctor 3.0.0-rc.2 crashes when there is a missing peer dependency #2752

Closed
benatshippabo opened this issue Apr 14, 2021 · 9 comments · Fixed by #3103
Closed

[Bug] Yarn doctor 3.0.0-rc.2 crashes when there is a missing peer dependency #2752

benatshippabo opened this issue Apr 14, 2021 · 9 comments · Fixed by #3103
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@benatshippabo
Copy link
Contributor

benatshippabo commented Apr 14, 2021

Describe the bug

So I think I found a bug with version 3.0.0-rc.2, when there is a mising peer dependency, it no longer lists the missing peer dependency and instead crashes with an error message:

➤ YN0000: ┌ /Users/btea/git/repo/packages/access/package.json
➤ YN0001: │ Error: Invalid property type: ArrayLiteralExpression
    at buildJsonNode (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:167:19)
    at async checkForUnmetPeerDependency (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:187:26)
    at async processManifest (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:227:17)
    at async processWorkspace (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:244:5)
    at async /Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:311:29
    at async StreamReport.startTimerPromise (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/node_modules/@yarnpkg/core/lib/StreamReport.js:219:20)
    at async /Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:298:25
    at async Function.start (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/node_modules/@yarnpkg/core/lib/StreamReport.js:132:13)
    at async EntryCommand.execute (/Users/btea/.npm/_npx/8344/lib/node_modules/@yarnpkg/doctor/lib/cli.js:285:24)

To Reproduce

Reproduction
const { promises: fs } = require(`fs`);

await packageJsonAndInstall({
dependencies: {
  [`react-dom`]: `^17.0.0`,
},
});

await fs.writeFile(`index.js`, `import ReactDOM from 'react-dom'`);

await expect(yarn(`dlx`, `@yarnpkg/doctor`)).resolves.toMatch(
"Unmet transitive peer dependency on react"
);

Also have a repo that minimally reproduces the problem: https://github.com/benatshippabo/yarn-doctor-bug

Screenshots

N/A

Environment if relevant (please complete the following information):

  • MacOS Big Sur
  • Node 12
  • Yarn version 3.0.0-rc.2

Additional context

Originally posted by @benatshippabo in #2534 (comment)

@benatshippabo benatshippabo added the bug Something isn't working label Apr 14, 2021
@yarnbot yarnbot added the unreproducible This issue cannot be reproduced on master label Apr 14, 2021
@yarnbot

This comment has been minimized.

@benatshippabo
Copy link
Contributor Author

I updated the reproduction, does it automatically re-run?

@yarnbot

This comment has been minimized.

1 similar comment
@yarnbot

This comment has been minimized.

@yarnbot yarnbot added reproducible This issue can be successfully reproduced and removed unreproducible This issue cannot be reproduced on master labels Apr 14, 2021
@yarnbot

This comment has been minimized.

@yarnbot

This comment has been minimized.

jyecusch added a commit to nitrictech/legacy-cli that referenced this issue Apr 20, 2021
lint:deps was pulling the latest @yarnpkg/doctor package, which upgraded us to a broken RC version. Added fixed version number for build safety.
Related to: yarnpkg/berry#2752
Also, fixed dependency issues to get lint:deps passing again.
@yarnbot
Copy link
Collaborator

yarnbot commented Apr 28, 2021

This issue reproduces on master:

Error: expect(received).resolves.toMatch()

Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js dlx @yarnpkg/doctor

➤ YN0000: ┌ Resolution step
::group::Resolution step
::endgroup::
➤ YN0000: └ Completed in 2s 291ms
➤ YN0000: ┌ Fetch step
::group::Fetch step
➤ YN0013: │  - one package was already cached, 194 had to be fetched
::endgroup::
➤ YN0000: └ Completed in 42s 226ms
➤ YN0000: ┌ Link step
::group::Link step
::endgroup::
➤ YN0000: └ Completed in 0s 335ms
➤ YN0000: Done in 44s 909ms

➤ YN0000: Found 1 package(s) to process
➤ YN0000: For a grand total of 1 file(s) to validate

➤ YN0000: ┌ /tmp/tmp-17u3dIjrMlI7bu/package.json
::group::/tmp/tmp-17u3dIjrMlI7bu/package.json
➤ YN0001: │ Error: Invalid property type: ArrayLiteralExpression
    at buildJsonNode (/github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:167:19)
    at async checkForUnmetPeerDependency (/github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:187:26)
    at async processManifest (/github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:227:17)
    at async processWorkspace (/github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:244:5)
    at async /github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:311:29
    at async StreamReport.startTimerPromise (/github/home/.yarn/berry/cache/@yarnpkg-core-npm-3.0.0-rc.2-9d35d08eb4-8.zip/node_modules/@yarnpkg/core/lib/StreamReport.js:219:20)
    at async /github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:298:25
    at async Function.start (/github/home/.yarn/berry/cache/@yarnpkg-core-npm-3.0.0-rc.2-9d35d08eb4-8.zip/node_modules/@yarnpkg/core/lib/StreamReport.js:132:13)
    at async EntryCommand.execute (/github/home/.yarn/berry/cache/@yarnpkg-doctor-npm-3.0.0-rc.2-6eedba3282-8.zip/node_modules/@yarnpkg/doctor/lib/cli.js:285:24)
    at async EntryCommand.validateAndExecute (/tmp/xfs-f10bf9ef/dlx-41/.yarn/__virtual__/clipanion-virtual-3710aedaf2/4/github/home/.yarn/berry/cache/clipanion-npm-3.0.0-rc.12-95ffbe8b7e-8.zip/node_modules/clipanion/lib/advanced/Command.js:64:26)
::endgroup::
➤ YN0000: └ Completed in 0s 241ms

➤ YN0000: Failed with errors in 0s 246ms
]
    at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0c0da74930.zip/node_modules/expect/build/index.js:138:15)
    at module.exports (evalmachine.<anonymous>:12:7)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.2-91650a2501-627bee24a7.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
    at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
    at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-91cf93ba72.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)

@renanvalentin
Copy link

@benatshippabo did you manage to find a solution for this one?

@benatshippabo
Copy link
Contributor Author

@renanvalentin nope, still waiting for a fix for version 3 🥺 . You could, however, always just run version 2:

yarn dlx @yarnpkg/doctor@2.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
3 participants