denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
97.31k stars 5.36k forks source link

`nuxt preview` falls in latest canary #25779

Open nathanwhit opened 1 month ago

nathanwhit commented 1 month ago

Repro:

❯ deno run -A npm:nuxi init
# just press enter at each prompt
❯ cd nuxt-app
❯ deno task build
❯ deno task preview
 ERROR  The "nodePath" option must be a string or a file URL: /home/.deno/bin/deno.                                                                                                                                                                                                                                                                2:34:33 PM

  at safeNormalizeFileUrl (node_modules/nuxi/dist/chunks/index3.mjs:36:9)
  at handleNodeOption (node_modules/nuxi/dist/chunks/index3.mjs:2473:29)
  at normalizeOptions (node_modules/nuxi/dist/chunks/index3.mjs:2630:64)
  at handleAsyncArguments (node_modules/nuxi/dist/chunks/index3.mjs:7642:63)
  at execaCoreAsync (node_modules/nuxi/dist/chunks/index3.mjs:7617:110)
  at callBoundExeca (node_modules/nuxi/dist/chunks/index3.mjs:7844:5)
  at boundExeca (node_modules/nuxi/dist/chunks/index3.mjs:7815:44)
  at Object.run (node_modules/nuxi/dist/chunks/preview.mjs:132:11)
  at eventLoopTick (ext:core/01_core.js:175:7)
  at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.b8b195e1.mjs:1648:16)

 ERROR  The "nodePath" option must be a string or a file URL: /home/.deno/bin/deno

I looked into this. The issue is that the named export of execPath from node:process is not actually a string, but an object that tries to act like a string: https://github.com/denoland/deno/blob/55c22ee1bd8e5b108b8b13517150c3cfadf4d7f9/ext/node/polyfills/process.ts#L344-L357

lucacasonato commented 1 month ago

Unfortunately incredibly difficult to fix, because Deno.execPath() requires permissions so we can not eagerly compute the string. And we can't make it a getter because it's an ESM export.