[rush] rush update/install fails when the default subspace has no packages on PNPM versions 9 and 10
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
-
rush init - Delete
common/config/rush/.pnpmfile.cjs - Create
common/config/subspaces/defaultandcommon/config/subspaces/myspacedirectories - 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": "*"
}
}
-
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:
.: {}
- Update
rush.json:
"rushVersion": "5.162.0",
"pnpmVersion": "9.15.9",
-
rush update(install-run-* scripts get updated) -
rush install --purge(no failure) -
rush update --recheckto 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:
.: {}
-
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.
-
rush update --full(finishes successfully) -
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: https://github.com/microsoft/rushstack/blob/23f78ab272da0bfe7bd5c7d1bf563ee3889acd14/libraries/rush-lib/src/logic/pnpm/PnpmShrinkwrapFile.ts#L347-L351
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 |
Hi, i had the same error when bumping from a much older rush version (5.103).
It turns out the useWorkspaces prop got set to true in pnpm-config.json
* This option is strongly recommended. The default value is false.
*/
"useWorkspaces": true,
Putting it back to false fixed it for me.
Disabling workspaces isn't a tenable solution for this issue. I have a fix in https://github.com/microsoft/rushstack/pull/5515