Skip to content

vp config with VP_GIT_HOOKS=0 still requires git #2441

Description

@Phillip9587

Describe the bug

VP_GIT_HOOKS=0 is documented as disabling Git-hook installation from lifecycle scripts such as prepare. However, a Docker build based on a minimal Node image without Git fails while running the prepare script with vp config.

vp config calls resolveHooksLocation() before invoking install(). That resolution needs the git executable the VP_GIT_HOOK=0 environment-variable check only happens later inside install().

export function install(dir?: string, options: InstallOptions = {}): InstallResult {
// VP_GIT_HOOKS is the canonical name; VITE_GIT_HOOKS is kept for backwards compatibility.
if (
process.env.HUSKY === '0' ||
process.env.VP_GIT_HOOKS === '0' ||
process.env.VITE_GIT_HOOKS === '0'
) {
return { message: 'skip install (git hooks disabled)', isError: false };
}

Expected: VP_GIT_HOOKS=0 pnpm install succeeds without Git installed.

Actual: vp config exits with git command not found.

Reproduction

https://github.com/Phillip9587/vite-plus-config-git-error-minimal-repro

Steps to reproduce

  1. Setup Docker on the machine
  2. Checkout https://github.com/Phillip9587/vite-plus-config-git-error-minimal-repro
  3. Run docker build .

System Info

vp env current
VITE+ - The Unified Toolchain for the Web

Environment:
  Version       24.19.0
  Source        devEngines.runtime
  Source Path   /home/user/somepath/package.json
  Project Root  /home/user/somepath

Tool Paths:
  node  /home/user/.vite-plus/js_runtime/node/24.19.0/bin/node
  npm   /home/user/.vite-plus/js_runtime/node/24.19.0/bin/npm
  npx   /home/user/.vite-plus/js_runtime/node/24.19.0/bin/npx

Package Manager:
  Name          pnpm
  Version       11.21.0
  Source        devEngines.packageManager
  Source Path   /home/user/somepath/package.json
  Project Root  /home/user/somepath
  Bin Path      /home/user/.vite-plus/package_manager/pnpm/11.21.0/pnpm/bin/pnpm

vp --version
VITE+ - The Unified Toolchain for the Web

vp v0.2.9

Local vite-plus:
  vite-plus  v0.2.9

Tools:
  vite             v8.2.1
  rolldown         v1.2.3
  vitest           v4.1.10
  oxfmt            v0.62.0
  oxlint           v1.77.0
  oxlint-tsgolint  v7.0.2001
  tsdown           v0.22.14

Environment:
  Package manager  pnpm ^11.21.0
  Node.js          v24.19.0 (devEngines.runtime)

Used Package Manager

pnpm

Logs

docker build . --progress=plain --no-cache
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 194B done
#1 DONE 0.0s

#2 [internal] load metadata for docker.io/library/node:24-alpine
#2 DONE 0.4s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [1/5] FROM docker.io/library/node:24-alpine@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43
#4 resolve docker.io/library/node:24-alpine@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43 0.0s done
#4 DONE 0.0s

#5 [2/5] WORKDIR /app
#5 CACHED

#6 [internal] load build context
#6 transferring context: 69B done
#6 DONE 0.0s

#7 [3/5] RUN npm install -g pnpm@^11.21.0
#7 1.125 
#7 1.125 added 1 package in 908ms
#7 1.125 
#7 1.125 1 package is looking for funding
#7 1.125   run `npm fund` for details
#7 1.126 npm notice
#7 1.126 npm notice New major version of npm available! 11.17.0 -> 12.0.2
#7 1.126 npm notice Changelog: https://github.com/npm/cli/releases/tag/v12.0.2
#7 1.126 npm notice To update run: npm install -g npm@12.0.2
#7 1.126 npm notice
#7 DONE 1.2s

#8 [4/5] COPY package.json pnpm-lock.yaml ./
#8 DONE 0.1s

#9 [5/5] RUN VP_GIT_HOOKS=0 pnpm install --frozen-lockfile
#9 0.663 ? Verifying lockfile against supply-chain policies (177 entries)...
#9 0.667 Lockfile is up to date, resolution step is skipped
#9 0.733 Progress: resolved 1, reused 0, downloaded 0, added 0
#9 0.749 Packages: +85
#9 0.749 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#9 0.999 Packages are hard linked from the content-addressable store to the virtual store.
#9 0.999   Content-addressable store is at: /root/.local/share/pnpm/store/v11
#9 0.999   Virtual store is at:             node_modules/.pnpm
#9 1.734 Progress: resolved 85, reused 0, downloaded 79, added 79
#9 2.111 ✓ Lockfile passes supply-chain policies (177 entries in 1.4s)
#9 2.734 Progress: resolved 85, reused 0, downloaded 84, added 84
#9 3.086 Progress: resolved 85, reused 0, downloaded 85, added 85, done
#9 3.133 
#9 3.133 devDependencies:
#9 3.133 + vite-plus 0.2.9
#9 3.133 
#9 3.136 $ vp config
#9 3.301 git command not found
#9 3.347 [ELIFECYCLE] Command failed with exit code 1.
#9 ERROR: process "/bin/sh -c VP_GIT_HOOKS=0 pnpm install --frozen-lockfile" did not complete successfully: exit code: 1
------
 > [5/5] RUN VP_GIT_HOOKS=0 pnpm install --frozen-lockfile:
2.111 ✓ Lockfile passes supply-chain policies (177 entries in 1.4s)
2.734 Progress: resolved 85, reused 0, downloaded 84, added 84
3.086 Progress: resolved 85, reused 0, downloaded 85, added 85, done
3.133 
3.133 devDependencies:
3.133 + vite-plus 0.2.9
3.133 
3.136 $ vp config
3.301 git command not found
3.347 [ELIFECYCLE] Command failed with exit code 1.
------
Dockerfile:9
--------------------
   7 |     COPY package.json pnpm-lock.yaml ./
   8 |     
   9 | >>> RUN VP_GIT_HOOKS=0 pnpm install --frozen-lockfile
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c VP_GIT_HOOKS=0 pnpm install --frozen-lockfile" did not complete successfully: exit code:1

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    Priority

    None yet

    Effort

    None yet

    Target date

    None yet

    Start date

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions