yarnpkg / yarnpkg/berry

[Bug?]: YN0001: TypeError: Cannot destructure property 'deprecated' of 'fe.versions[ue]' as it is undefined.

Open
#6,301 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
8.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Self-service
  • I'd be willing to implement a fix
Describe the bug

On CI this error happens from time to time.

YN0001: TypeError: Cannot destructure property 'deprecated' of 'fe.versions[ue]' as it is undefined.
  at /agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:680:5858 at Object.ol (/agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:140:53068)
  at /agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:680:5822 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async Promise.all (index 1252) at async /agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:680:5683
  at async fA.start (/agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:199:6859)
  at async q0.execute (/agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:680:5456) at async q0.validateAndExecute (/agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:94:787)
  at async as.run (/agent/_work/1/s/.yarn/releases/yarn-4.2.2.cjs:98:3250)

➤ Errors happened when preparing the environment required to run this command.
➤ This might be caused by packages being missing from the lockfile, in which case running "yarn install" might help.

The error points to: https://github.com/yarnpkg/berry/blob/bfa6489467e0e11ee87268e01e38e4f7e8d4d4b0/packages/plugin-npm-cli/sources/commands/npm/audit.ts#L140

To reproduce
yarn npm audit --all --recursive
Environment
System:
    OS: linux
    CPU: 
  Binaries:
    Node: 20.13.1
    Yarn: 4.2.2
Additional context

I do not know why the error happens sometimes, while most of the time works fine (race condition?).
Not reproducible on local machine.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/plugin-npm-cli/sources/commands/npm/audit.ts around line 140 and run yarn npm audit --all --recursive using the reported Yarn and Node versions. Investigate why fe.versions[ue] can be undefined during the audit, then verify the command no longer raises this TypeError when preparing the environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cli, security, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.