Agent shell set NODE_ENV to production

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Agent shell set NODE_ENV to production

Steps to Reproduce

Ask cursor agent to echo $NODE_ENV

Expected Behavior

Cursor Agent should not set ANY env var by default

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 1.6.42
VSCode Version: 1.99.3
Commit: 5911e9593196a000b1c00553aaf03b0b32042b90
Date: 2025-09-20T17:16:56.346Z
Electron: 34.5.8
Chromium: 132.0.6834.210
Node.js: 20.19.1
V8: 13.2.152.41-electron.0
OS: Darwin arm64 24.6.0

Additional Information

Related: MAJOR ISSUE: Agent terminal set "ELECTRON_RUN_AS_NODE"

Does this stop you from using Cursor

Yes - Cursor is unusable

2 Likes

Hey, thanks for the report. Could you let me know which model you’re using?

Claude sonnet 4

1 Like

Issue

Cursor’s shell integration (cursor-shell) automatically sets NODE_ENV=production in terminal sessions. This breaks standard Node.js development workflows, particularly:

  • Next.js dev server (attempts to run production build, fails when .next folder is missing)
  • Create React App and other build tools that rely on NODE_ENV being unset or development

Root Cause

The process hierarchy shows cursor-shell sits between iTerm and the user’s shell:
iTerm → cursor-shell → /bin/zsh

Because the injection happens above the shell level, the NODE_ENV variable:

  • Persists even after restarting the shell
  • Cannot be cleared with unset NODE_ENV (immediately returns)
  • Only disappears when opening new terminal windows after disabling Cursor’s shell integration

Debugging Challenge

This issue is extremely difficult to diagnose because:

  1. No configuration files show this setting
  2. The variable isn’t set in any shell initialization files
  3. Standard debugging approaches (new shell sessions, env -i tests) don’t reveal the problem
  4. The injection is completely transparent to the user

Resolution

After uninstalling cursor-agent shell integration (and possibly Cursor IDE shell integration) and opening new terminal windows (not just new shells), NODE_ENV was finally unset.

Request

Please reconsider this design. Setting NODE_ENV=production by default in development tools is counterintuitive and breaks standard workflows. If this is intended as a safety measure, it should be:

  1. Optional and configurable
  2. Clearly documented
  3. Visible to users (not silently injected)

At minimum, development tools should default to NODE_ENV=development or leave it unset, allowing developers to set it explicitly when needed.

Same issue here. My development workflow broke following Cursor update as NODE_ENV=production caused issues like npm i not installing dev deps (and more).

This looks like a bug - or at least a breaking change that should be advertised.

@deanrie the issue seems to impact more and more users

Yes, the team is working on it.

2 Likes