Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip automatic download/install of Node.js versions in WebContainer #7478

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/late-seals-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"pnpm": patch
---

Don't install Node.js when use-node-version is set in a WebContainer [#7478](https://github.com/pnpm/pnpm/pull/7478).
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,12 @@
"uuidv",
"valign",
"vuln",
"webcontainer",
"winst",
"wrappy",
"xmarw",
"zkochan",
"zoli",
"zoltan"
"zoltan"
]
}
12 changes: 8 additions & 4 deletions pnpm/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@pnpm/config'
import { executionTimeLogger, scopeLogger } from '@pnpm/core-loggers'
import { filterPackagesFromDir } from '@pnpm/filter-workspace-packages'
import { logger } from '@pnpm/logger'
import { globalWarn, logger } from '@pnpm/logger'
import { type ParsedCliArgs } from '@pnpm/parse-cli-args'
import { node } from '@pnpm/plugin-commands-env'
import { finishWorkers } from '@pnpm/worker'
Expand Down Expand Up @@ -271,9 +271,13 @@ export async function main (inputArgv: string[]) {
})

if (config.useNodeVersion != null) {
const nodePath = await node.getNodeBinDir(config)
config.extraBinPaths.push(nodePath)
config.nodeVersion = config.useNodeVersion
if ('webcontainer' in process.versions) {
globalWarn('Automatic installation of different Node.js versions is not supported in WebContainer')
} else {
const nodePath = await node.getNodeBinDir(config)
config.extraBinPaths.push(nodePath)
config.nodeVersion = config.useNodeVersion
}
}
let result = pnpmCmds[cmd ?? 'help'](
// TypeScript doesn't currently infer that the type of config
Expand Down