Skip to content

fix(ext/node): make execPath named export a real string#32396

Merged
bartlomieju merged 2 commits intodenoland:mainfrom
bartlomieju:fix/process-execpath-typeof
Mar 2, 2026
Merged

fix(ext/node): make execPath named export a real string#32396
bartlomieju merged 2 commits intodenoland:mainfrom
bartlomieju:fix/process-execpath-typeof

Conversation

@bartlomieju
Copy link
Member

Summary

  • The named ESM export execPath from node:process was a frozen object with String.prototype that pretended to be a string but had typeof === "object". This broke libraries like execa that check typeof execPath === "string", causing nuxt preview to fail with The "nodePath" option must be a string or a file URL.
  • Now execPath is initialized as "" and set to Deno.execPath() during __bootstrapNodeProcess, so both process.execPath and the named import are real strings.

Before:

import { execPath } from "node:process";
typeof execPath // "object"

After:

import { execPath } from "node:process";
typeof execPath // "string"

Test plan

  • Verified typeof execPath === "string" for both named import and process.execPath
  • Verified both return the correct path
  • Existing tests pass

Closes #25779

🤖 Generated with Claude Code

The named ESM export `execPath` from `node:process` was a frozen object
with `String.prototype` that pretended to be a string but had
`typeof === "object"`. This broke libraries like execa that check
`typeof execPath === "string"`, causing nuxt preview to fail.

Now `execPath` is initialized as an empty string and set to
`Deno.execPath()` during bootstrap, so both `process.execPath` and
the named import are real strings.

Closes denoland#25779

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bartlomieju
Copy link
Member Author

This will conflict with #28915.

@marvinhagemeister
Copy link
Contributor

Let's add a test case

@bartlomieju bartlomieju enabled auto-merge (squash) March 2, 2026 13:27
@bartlomieju bartlomieju merged commit e726953 into denoland:main Mar 2, 2026
220 of 222 checks passed
@bartlomieju bartlomieju deleted the fix/process-execpath-typeof branch March 2, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nuxt preview falls in latest canary

3 participants