Skip to content

Commit

Permalink
fix: correctly detect the active Node js version during headless inst…
Browse files Browse the repository at this point in the history
…allation (#7801)

close #5266

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
  • Loading branch information
dy-dx and zkochan committed Mar 17, 2024
1 parent 3c50981 commit 4eac871
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changeset/nasty-goats-care.md
@@ -0,0 +1,6 @@
---
"@pnpm/core": patch
"pnpm": patch
---

Correctly detect the active Node.js version during headless installation [#7801](https://github.com/pnpm/pnpm/pull/7801).
2 changes: 1 addition & 1 deletion config/package-is-installable/src/index.ts
Expand Up @@ -90,4 +90,4 @@ export function checkPackage (
pnpm: options.pnpmVersion,
})
)
}
}
Expand Up @@ -26,7 +26,7 @@ export function filterLockfileByEngine (

export interface FilterLockfileOptions {
currentEngine: {
nodeVersion: string
nodeVersion?: string
pnpmVersion: string
}
engineStrict: boolean
Expand Down Expand Up @@ -92,7 +92,7 @@ function pickPkgsWithAllDeps (
importerIdSet: Set<string>,
opts: {
currentEngine: {
nodeVersion: string
nodeVersion?: string
pnpmVersion: string
}
engineStrict: boolean
Expand All @@ -119,7 +119,7 @@ function pkgAllDeps (
parentIsInstallable: boolean,
opts: {
currentEngine: {
nodeVersion: string
nodeVersion?: string
pnpmVersion: string
}
engineStrict: boolean
Expand Down
4 changes: 2 additions & 2 deletions pkg-manager/core/src/install/extendInstallOptions.ts
Expand Up @@ -68,7 +68,7 @@ export interface StrictInstallOptions {
onlyBuiltDependenciesFile?: string
nodeExecPath?: string
nodeLinker: 'isolated' | 'hoisted' | 'pnp'
nodeVersion: string
nodeVersion?: string
packageExtensions: Record<string, PackageExtension>
packageManager: {
name: string
Expand Down Expand Up @@ -186,7 +186,7 @@ const defaults = (opts: InstallOptions) => {
},
lockfileDir: opts.lockfileDir ?? opts.dir ?? process.cwd(),
lockfileOnly: false,
nodeVersion: process.version,
nodeVersion: opts.nodeVersion,
nodeLinker: 'isolated',
overrides: {},
ownLifecycleHooksStdio: 'inherit',
Expand Down
2 changes: 1 addition & 1 deletion pkg-manager/headless/src/index.ts
Expand Up @@ -102,7 +102,7 @@ export interface HeadlessOptions {
childConcurrency?: number
currentLockfile?: Lockfile
currentEngine: {
nodeVersion: string
nodeVersion?: string
pnpmVersion: string
}
dedupeDirectDeps?: boolean
Expand Down
Expand Up @@ -155,7 +155,7 @@ export interface ResolutionContext {
preferWorkspacePackages?: boolean
readPackageHook?: ReadPackageHook
engineStrict: boolean
nodeVersion: string
nodeVersion?: string
pnpmVersion: string
registries: Registries
resolutionMode?: 'highest' | 'time-based' | 'lowest-direct'
Expand Down
Expand Up @@ -84,7 +84,7 @@ export interface ResolveDependenciesOptions {
hooks: {
readPackage?: ReadPackageHook
}
nodeVersion: string
nodeVersion?: string
registries: Registries
patchedDependencies?: Record<string, PatchFile>
pnpmVersion: string
Expand Down

0 comments on commit 4eac871

Please sign in to comment.