microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.94k stars 598 forks source link

[rush] Invalid package linking with npm #3361

Open rauno56 opened 2 years ago

rauno56 commented 2 years ago

Summary

Getting unexpected results in how the packages are linked using npm. Every package except @opentelemetry/resource-detector-docker in the monorepo pin the version of typescript to 4.3.5. The docker detector has looser and incompatible version specified: ^4.5.5. All packages get invalidly linked to the version installed under auto-instrumentations-node.

Instead at the time of writing this, I would expect

Repro steps

git clone --branch chore/rush-npm https://github.com/Rauno56/opentelemetry-js-contrib.git
node common/scripts/install-run-rush.js install
(cd plugins/node/instrumentation-fs/; npx tsc -v) # expecting "4.3.5" because the dependency is pinned, actual: "4.6.3"
(cd detectors/node/opentelemetry-resource-detector-docker/; npx tsc -v) # seeing expected version: "4.6.3"

Actual/Expected result: see above

Details

npm list typescript in common/temp shows us that necessary versions are all present:

rush-common@0.0.0 /tmp/tmp.UjOlfJc7zi/opentelemetry-js-contrib/common/temp
β”œβ”€β”¬ @rush-temp/auto-instrumentations-node@0.0.0
β”‚ β”œβ”€β”¬ gts@3.1.0
β”‚ β”‚ β”œβ”€β”¬ @typescript-eslint/eslint-plugin@4.33.0
β”‚ β”‚ β”‚ └─┬ tsutils@3.21.0
β”‚ β”‚ β”‚   └── typescript@4.6.3 deduped
β”‚ β”‚ └── typescript@4.6.3 deduped
β”‚ └── typescript@4.3.5
[ ... ]
β”œβ”€β”¬ @rush-temp/instrumentation-fs@0.0.0
β”‚ └── typescript@4.3.5
[ ... ]
β”œβ”€β”¬ @rush-temp/resource-detector-docker@0.0.0
β”‚ └── typescript@4.6.3
[ ... ]

but linking for packages are done wrong by linking typescript under auto-instrumentations-node.

For one of the modules that have it pinned:

plugins/node/instrumentation-fs on ξ‚  HEAD (87e7097)
❯ readlink node_modules/typescript
../../../../common/temp/node_modules/@rush-temp/auto-instrumentations-node/node_modules/typescript # <- 4.6

For resource-detector-docker which should get the latest:

detectors/node/opentelemetry-resource-detector-docker on ξ‚  HEAD (87e7097) [$!?] is πŸ“¦ v0.1.0 via  v16.13.2 
❯ readlink node_modules/typescript
../../../../common/temp/node_modules/typescript # <- 4.6

Standard questions

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

Question Answer
@microsoft/rush globally installed version? 5.64.0
rushVersion from rush.json? 5.64.0
useWorkspaces from rush.json? false
Operating system? Linux
Would you consider contributing a PR? Yes, but need direction
Node.js version (node -v)? 16.13.2
npm version? 8.6.0
rauno56 commented 2 years ago

I now noticed the comment about npm@4.5.0 being the latest version that's known to be working. I did only try npm@6 and npm@8 originally.

Testing it now, however, npm@4 errors on even earlier with an error that's unclear to me off the bat.