Skip to content

[Bug?]: Internal Error: @myorg/ui-foo-widget@workspace:.: does not exist in yarn.lock file #6809

Open
@jbarker4682

Description

@jbarker4682

Self-service

  • I'd be willing to implement a fix

Describe the bug

We are upgrading from Yarn 1 to Yarn 4.9.1 and encountering the above error when trying to publish a workspace from our monorepo to our internal Artifactory repository (see simplified example ui-monorepo.zip)

I have verified the following:

  • workspaces in the root project.json file is correct ("apps/*") and "private": true
  • apps/foo-widget/package.json has correct name ("@myorg/ui-foo-widget") and "private": false
  • .yarnrc.yml and .npmrc have correct authentication settings for reading and publishing to Artifactory
  • I have cleared yarn cache and re-run yarn install and confirmed that my workspace project is added to the yarn.lock file (see below).

Note: The error message says that Yarn is looking for @myorg/ui-foo-widget@workspace:. not @myorg/ui-foo-widget@workspace:apps/foo-widget, which I think is the problem but don't know how to fix as internet says running yarn install with correct workspace configuration and package.json names should resolve this.

example root yarn.lock file

`__metadata:
version: 8
cacheKey: 10

"@myorg/ui-foo-widget@workspace:apps/foo-widget":
version: 0.0.0-use.local
resolution: "@myorg/ui-foo-widget@workspace:apps/foo-widget"
languageName: unknown
linkType: soft`

I get the same error when running any of the following commands:

from monorepo root (e.g. ui-monorepo)

  • yarn --cwd apps/foo-widgcet/ npm publish
  • yarn workspace @myorg/ui-foo-widget npm publish

from project root (e.g. ui-monorepo/apps/foo-widget)

  • yarn npm publish

all result in:

Internal Error: @myorg/ui-foo-widget@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install" to update the lockfile at GR.getCandidates (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:205:8149) at rm.getCandidates (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:141:1311) at /Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:210:8420 at GE (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:140:54028) at gt (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:210:8400) at async Promise.allSettled (index 0) at async Uu (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:140:53356) at async /Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:210:9166 at async Wi.startProgressPromise (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:140:139721) at async t.resolveEverything (/Users/xx.xx/code/ui-monorepo/.yarn/releases/yarn-4.9.1.cjs:210:7138)

I've spent about a week so far trying to troubleshoot this and other publish related issues and would greatly appreciate any help / 2nd set of eyes (thank you!)

To reproduce

Download the example ui-monorepo.zip or create a basic yarn package based monorepo with similar configuration settings and attempt to run yarn npm info or yarn npm publish from the root or project directory.

Environment

System:
  OS: macOS 15.4.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Binaries:
  Node: 22.13.1 - /private/var/folders/l8/5_t3t09d0c9c32yg585f4yzw0000gq/T/xfs-1214c4ff/node
  Yarn: 4.9.1 - /private/var/folders/l8/5_t3t09d0c9c32yg585f4yzw0000gq/T/xfs-1214c4ff/yarn
  npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions