[heft] Error: Cannot find module 'colors/safe'
leonitousconforti opened this issue · 6 comments
Summary
Just tested out heft@0.64.8, was on heft@0.64.7. Am seeing
Error: Cannot find module 'colors/safe'
Error: Cannot find module 'colors/safe'
Require stack:
- /workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+terminal@0.8.0_@types+node@20.11.19/node_modules/@rushstack/terminal/lib/ConsoleTerminalProvider.js
- /workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+terminal@0.8.0_@types+node@20.11.19/node_modules/@rushstack/terminal/lib/index.js
- /workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+heft@0.64.8_patch_hash=ox6odirr3wstbc5ukwnhm7ow6q_@types+node@20.11.19/node_modules/@rushstack/heft/lib/cli/HeftCommandLineParser.js
- /workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+heft@0.64.8_patch_hash=ox6odirr3wstbc5ukwnhm7ow6q_@types+node@20.11.19/node_modules/@rushstack/heft/lib/start.js
- /usr/local/share/nvm/versions/node/v20.11.1/lib/node_modules/@rushstack/heft/lib/startWithVersionSelector.js
- /usr/local/share/nvm/versions/node/v20.11.1/lib/node_modules/@rushstack/heft/bin/heft
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (/workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+terminal@0.8.0_@types+node@20.11.19/node_modules/@rushstack/terminal/lib/ConsoleTerminalProvider.js:7:16)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+terminal@0.8.0_@types+node@20.11.19/node_modules/@rushstack/terminal/lib/ConsoleTerminalProvider.js',
'/workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+terminal@0.8.0_@types+node@20.11.19/node_modules/@rushstack/terminal/lib/index.js',
'/workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+heft@0.64.8_patch_hash=ox6odirr3wstbc5ukwnhm7ow6q_@types+node@20.11.19/node_modules/@rushstack/heft/lib/cli/HeftCommandLineParser.js',
'/workspaces/the-wireguard-effect/node_modules/.pnpm/@rushstack+heft@0.64.8_patch_hash=ox6odirr3wstbc5ukwnhm7ow6q_@types+node@20.11.19/node_modules/@rushstack/heft/lib/start.js',
'/usr/local/share/nvm/versions/node/v20.11.1/lib/node_modules/@rushstack/heft/lib/startWithVersionSelector.js',
'/usr/local/share/nvm/versions/node/v20.11.1/lib/node_modules/@rushstack/heft/bin/heft'
]
}
Repro steps
install heft@0.64.8
Expected result:
Actual result:
Details
Should note that my npmrc is:
hoist = false
hoist-pattern=
public-hoist-pattern=
My guess is that when ConsoleTerminalProvider
was moved 3 days ago colors didn't get added to the dependencies of @rushstack/terminal
Standard questions
Please answer these questions to help us investigate your issue more quickly:
Question | Answer |
---|---|
@rushstack/heft version? |
0.64.8 |
Operating system? | linux |
Would you consider contributing a PR? | sure? |
Node.js version (node -v )? |
v20.11.1 |
@iclanton this sounds like a regression from #3176
I'm surprised the install-test-workspace project didn't catch this, it invokes ConsoleTerminalProvider
.
Oh, apparently it depends on colors. 😆
I'm working on a fix
Interesting. I'm not sure how this ever worked if ConsoleTerminalProvider
had a runtime dependency on colors
and the package only had a dev dependency.
Here is the PR: #4527
Interesting. I'm not sure how this ever worked if
ConsoleTerminalProvider
had a runtime dependency oncolors
and the package only had a dev dependency.
I think what happened is that the Jest test cases always had a devDependency
on colors
, but the Terminal APIs themselves never relied upon it.
But then at some point ConsoleTerminalProvider.supportsColor
picked up a tiny dependency on colors
, which was a regular dependency
in node-core-library
but only a devDependency
in @rushstack/terminal
.
The reason why install-test-workspace
does not catch it is very interesting. I spent 20 minutes removing extra dependencies but somehow it still manages to resolve via the .pnpm
folder.
The reason why
install-test-workspace
does not catch it is very interesting. I spent 20 minutes removing extra dependencies but somehow it still manages to resolve via the.pnpm
folder.
Okay in this PR I have improved install-test-workspace
to reproduce the bug: #4528
...and then confirmed that it is fixed by PR #4527
🚀 We've published @rushstack/heft@0.65.1
and @rushstack/terminal@0.8.1
which should resolve the problem.
@leonitousconforti thank you for reporting this!