vercel / vercel/next.js

nextjs dev server can't be started with additional `-r` node parameters

Open
#77,550 25 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Script (next/script)
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/stinaq/newrelic-node-examples/tree/main/nextjs/nextjs-app-router

To Reproduce
  1. npm install to get correct dependencies
  2. npm run dev to start dev server

running this runs the command

NODE_OPTIONS='-r dotenv/config --loader newrelic/esm-loader.mjs -r newrelic' next dev

it's starting the dev server according to Newrelic setup.

I filed an issue over at their repo, but they are saying the issue comes from the next CLI.

Specifically this line

Current vs. Expected behavior

When running this command, starting the server fails with the following error message:

--r= is not allowed in NODE_OPTIONS

note that the command run does not include --r.

Expected behavior is that the server can run

Provide environment information
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:24 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 12
Binaries:
  Node: 20.19.0
  npm: 10.8.2
  Yarn: N/A
  pnpm: 9.5.0
Relevant Packages:
  next: 15.2.4 // Latest available version is detected (15.2.4).
  eslint-config-next: 14.1.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.8.2
Next.js Config:
  output: N/A
Which area(s) are affected? (Select all that apply)

Script (next/script)

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

I filed an issue over at their repo, but they are saying the issue comes from the next CLI.

Specifically this line

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at packages/next/src/server/lib/utils.ts line 195 and reproduce the failure with the reported NODE_OPTIONS command from the linked example application. Investigate why the additional -r parameters are reported as --r=, then verify that next dev starts successfully with the New Relic and dotenv options.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, node.js
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.