rushstack
rushstack copied to clipboard
[rush] `rush update` fail if the whole project has 0 dependencies
Summary
I'm trying to create a new rush monorepo. After adding my first empty package, I invoked rush update
, and it failed with
$ rush --debug update
Rush Multi-Project Build Tool 5.62.4 - https://rushjs.io
Node.js version is 16.13.1 (LTS)
Starting "rush update"
Trying to acquire lock for pnpm-6.7.1
Acquired lock for pnpm-6.7.1
Found pnpm version 6.7.1 in /Users/simon/.rush/node-v16.13.1/pnpm-6.7.1
Symlinking "/Users/simon/git/yume-chan/rush-test/common/temp/pnpm-local"
--> "/Users/simon/.rush/node-v16.13.1/pnpm-6.7.1"
Transforming /Users/simon/git/yume-chan/rush-test/common/config/rush/.npmrc
--> "/Users/simon/git/yume-chan/rush-test/common/temp/.npmrc"
Updating workspace files in /Users/simon/git/yume-chan/rush-test/common/temp
Checking installation in "/Users/simon/git/yume-chan/rush-test/common/temp"
Skipping package registry setup because packageRegistry.enabled=false
Running "pnpm install" in /Users/simon/git/yume-chan/rush-test/common/temp
Invoking package manager: /Users/simon/.rush/node-v16.13.1/pnpm-6.7.1/node_modules/pnpm/bin/pnpm.cjs install --store /Users/simon/git/yume-chan/rush-test/common/temp/pnpm-store --no-prefer-frozen-lockfile --recursive --link-workspace-packages false
Scope: all 2 workspace projects
Using hooks from: /Users/simon/git/yume-chan/rush-test/common/temp/.pnpmfile.cjs
readPackage hook is declared. Manifests of dependencies might get overridden
ERROR: Cannot read properties of undefined (reading 'getProjectShrinkwrap')
TypeError: Cannot read properties of undefined (reading 'getProjectShrinkwrap')
at /Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/logic/installManager/WorkspaceInstallManager.js:285:45
at Array.map (<anonymous>)
at WorkspaceInstallManager.postInstallAsync (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/logic/installManager/WorkspaceInstallManager.js:283:59)
at WorkspaceInstallManager.doInstallAsync (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/logic/base/BaseInstallManager.js:150:20)
at async WorkspaceInstallManager.doInstallAsync (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/logic/installManager/WorkspaceInstallManager.js:57:9)
at async UpdateAction.runAsync (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/cli/actions/BaseInstallAction.js:121:13)
at async RushCommandLineParser.onExecute (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:199:13)
at async RushCommandLineParser._wrapOnExecuteAsync (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/cli/RushCommandLineParser.js:169:9)
at async RushCommandLineParser.onExecute (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@microsoft/rush-lib/lib/cli/RushCommandLineParser.js:150:13)
at async RushCommandLineParser.execute (/Users/simon/.volta/tools/image/packages/@microsoft/rush/lib/node_modules/@microsoft/rush/node_modules/@rushstack/ts-command-line/lib/providers/CommandLineParser.js:100:13)
Repro steps
mkdir rush-test
cd rush-test
git init
rush init
mkdir package-a
cd package-a
npm init -y
cd ..
# edit `rush.json` to add `package-a`
rush update
Here is the final state I get: https://github.com/yume-chan/rush-3250-repro
Details
Although a "real" project won't have 0 dependencies, it's an essential step to setup a real project.
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@microsoft/rush globally installed version? |
5.62.4 |
rushVersion from rush.json? |
5.62.4 |
useWorkspaces from rush.json? |
true |
Operating system? | macOS 12.1 |
Would you consider contributing a PR? | No |
Node.js version (node -v )? |
16.13.1 |
This is admittedly a rare situation (only happens when first setting up a monorepo).
But it's not a great "first impression" for newcomers.
Let's fix this.
bump
我也遇到过类似的问题。
原因:是我更新了@microsoft/rush,导致项目依赖没有关联,后面删除pnpm-lock.yaml文件导致ERROR: Cannot read properties of undefined (reading 'getProjectShrinkwrap')。 方案:我是将@microsoft/rush删了,重新下载指定5.62.4版本,还原pnpm-lock.yaml文件,最后再重新rush update --purge就好了。
Has this been fixed? I can't repro it on version 5.81.0