Skip to content

netlify dev --cwd ./ fails to find vite command in v22.1.7 and above #7528

@ffaubert

Description

@ffaubert

Describe the bug

After upgrading from netlify-cli v22.1.6 to v22.1.7, running netlify dev --cwd ./ fails with error "Failed running command: vite. Please verify 'vite' exists". The same command worked correctly in v22.1.6.

Steps to reproduce

Steps to Reproduce

  1. Have a monorepo with vite-based app in subdirectory
  2. Change to app directory: cd apps/app-name
  3. Run: netlify dev --cwd ./
  4. Observe error: "Failed running command: vite. Please verify 'vite' exists"

Expected Behavior

netlify dev should detect and start the vite dev server as it did in v22.1.6

Actual Behavior

Command fails immediately with error about vite not being found

Error Output

⬥ Starting framework dev server
⠋ Waiting for framework dev server to be ready on port 5173⬥ Failed running command: vite. Please verify 'vite' exists

Additional Context

This appears related to PR #7366 which modified cwd handling. The change deletes the cwd flag when it matches the process's current directory, which may be affecting how framework commands are resolved in monorepo setups.

Workaround

Downgrading to v22.1.6 resolves the issue.

Configuration

[build]
publish = "dist/"
command = "npm run build"
edge_functions = "src/edge-functions/"

[build.environment]
NODE_VERSION = "22.12.0"
NPM_VERSION = "11.0.0"
NODE_SOURCEMAP = "true"
NODE_OPTIONS = "--max_old_space_size=4096"

[functions]
node_bundler = "esbuild"
directory = "src/functions/"
external_node_modules = ["@sentry/serverless", "@block65/webcrypto-web-push"]
deno_import_map = "deno-import-map.json"

[dev]
command = "vite"
targetPort = 5173
port = 8888
autoLaunch = false

Environment

System:
OS: macOS 15.5
CPU: (16) arm64 Apple M4 Max
Memory: 64.45 GB / 128.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.17.1 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 11.5.2 - /usr/local/bin/npm
pnpm: 7.27.0 - /usr/local/bin/pnpm
bun: 1.2.19 - /opt/homebrew/bin/bun

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions