rushstack icon indicating copy to clipboard operation
rushstack copied to clipboard

[rush] Invalid package linking with npm

Open rauno56 opened this issue 3 years ago • 1 comments

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

  • [x] two versions to be installed after rush install(4.3.5 and 4.6.3)
  • [ ] [email protected] linked to @opentelemetry/resource-detector-docker and [email protected] for everything else.

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:

[email protected] /tmp/tmp.UjOlfJc7zi/opentelemetry-js-contrib/common/temp
├─┬ @rush-temp/[email protected]
│ ├─┬ [email protected]
│ │ ├─┬ @typescript-eslint/[email protected]
│ │ │ └─┬ [email protected]
│ │ │   └── [email protected] deduped
│ │ └── [email protected] deduped
│ └── [email protected]
[ ... ]
├─┬ @rush-temp/[email protected]
│ └── [email protected]
[ ... ]
├─┬ @rush-temp/[email protected]
│ └── [email protected]
[ ... ]

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 avatar Apr 20 '22 12:04 rauno56

I now noticed the comment about [email protected] 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.

rauno56 avatar Jun 17 '22 08:06 rauno56