Skip to content

[rush] rush update/install fails when the default subspace has no packages on PNPM versions 9 and 10 #5439

@santala

Description

@santala

Summary

I’m trying to update from Rush 5.155.1 to 5.162.0 and pnpm 8.15.9 to 10 (via 9 to update the lockfile format).

After updating to Rush 5.162.0 and pnpm 9.15.9 and after updating the lockfile format to 9.0, rush install fails during the default subspace update with the following error:

The shrinkwrap file has not been updated to support workspaces. Run "rush update --full" to update the shrinkwrap file.

However, while rush update --full will complete successfully, subsequent rush update and rush install commands will continue to fail.

Even though the installation fails, rush post-install hooks are still executed.

Repro steps

  1. rush init
  2. Delete common/config/rush/.pnpmfile.cjs
  3. Create common/config/subspaces/default and common/config/subspaces/myspace directories
  4. Update configs and create a package.json:
// rush.json
{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/rush.schema.json",
  "rushVersion": "5.155.1",
  "pnpmVersion": "8.15.9",
  "projects": [
    {
      "subspaceName": "myspace",
      "packageName": "mypackage",
      "projectFolder": "mypackage"
    }
  ]
}
// common/config/rush/subspaces.json
{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/subspaces.schema.json",
  "subspacesEnabled": true,
  "splitWorkspaceCompatibility": false,
  "preventSelectingAllSubspaces": false,
  "subspaceNames": [
    "myspace",
    "default"
  ]
}
// mypackage/package.json
{
  "name": "mypackage",
  "version": "1.0.0",
  "devDependencies": {
    "typescript": "*"
  }
}
  1. rush update
# myspace lockfile
lockfileVersion: '6.0'

settings:
  autoInstallPeers: false
  excludeLinksFromLockfile: false

importers:

  .: {}

  ../../../mypackage:
    devDependencies:
      typescript:
        specifier: '*'
        version: 5.9.3

packages:

  /[email protected]:
    resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
    engines: {node: '>=14.17'}
    hasBin: true
    dev: true
# default lockfile
lockfileVersion: '6.0'

settings:
  autoInstallPeers: false
  excludeLinksFromLockfile: false

importers:

  .: {}
  1. Update rush.json:
  "rushVersion": "5.162.0",
  "pnpmVersion": "9.15.9",
  1. rush update (install-run-* scripts get updated)
  2. rush install --purge (no failure)
  3. rush update --recheck to update the lockfile format:
# myspace lockfile
lockfileVersion: '9.0'

settings:
  autoInstallPeers: false
  excludeLinksFromLockfile: false

pnpmfileChecksum: fm2bgttvmfglngapbjspr7zf2u

importers:

  .: {}

  ../../../mypackage:
    devDependencies:
      typescript:
        specifier: '*'
        version: 5.9.3

packages:

  [email protected]:
    resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==}
    engines: {node: '>=14.17'}
    hasBin: true

snapshots:

  [email protected]: {}
# default lockfile
lockfileVersion: '9.0'

settings:
  autoInstallPeers: false
  excludeLinksFromLockfile: false

pnpmfileChecksum: fm2bgttvmfglngapbjspr7zf2u

importers:

  .: {}
  1. rush update
Found configuration in /workspaces/rush-bug-repro/rush.json


Rush Multi-Project Build Tool 5.162.0 - https://rushjs.io
Node.js version is 22.17.0 (LTS)


Starting "rush update"
Installing for subspace: default
Trying to acquire lock for pnpm-9.15.9
Acquired lock for pnpm-9.15.9
Found pnpm version 9.15.9 in /home/node/.rush/node-v22.17.0/pnpm-9.15.9

Symlinking "/workspaces/rush-bug-repro/common/temp/pnpm-local"
  --> "/home/node/.rush/node-v22.17.0/pnpm-9.15.9"
Transforming /workspaces/rush-bug-repro/common/config/subspaces/default/.npmrc
  --> "/workspaces/rush-bug-repro/common/temp/default/.npmrc"

Updating workspace files in /workspaces/rush-bug-repro/common/temp/default

The shrinkwrap file has not been updated to support workspaces. Run "rush update --full" to update the shrinkwrap file.
  1. rush update --full (finishes successfully)
  2. rush update
Updating workspace files in /workspaces/rush-bug-repro/common/temp/default

The shrinkwrap file has not been updated to support workspaces. Run "rush update --full" to update the shrinkwrap file.

Details

The problem seems to be with this check:

// Lockfile v9 always has "." in importers filed.
this.isWorkspaceCompatible =
this.shrinkwrapFileMajorVersion >= ShrinkwrapFileMajorVersion.V9
? this.importers.size > 1
: this.importers.size > 0;

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.162.0
rushVersion from rush.json? 5.155.1, 5.162.0
useWorkspaces from rush.json? unset
Operating system? Mac
Would you consider contributing a PR? Maybe
Node.js version (node -v)? 22.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Investigation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions