Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno run -A npm:create-next-app -e hello-world does not work #26383

Open
arnauorriols opened this issue Oct 18, 2024 · 2 comments
Open

deno run -A npm:create-next-app -e hello-world does not work #26383

arnauorriols opened this issue Oct 18, 2024 · 2 comments
Labels
bug Something isn't working correctly node compat upstream Changes in upstream are required to solve these issues

Comments

@arnauorriols
Copy link
Member

Version: Deno 2.0.2
Error:

TypeError: Invalid URL: 'hello-world'
    at getSerialization (ext:deno_url/00_url.js:98:11)
    at new URL (ext:deno_url/00_url.js:405:27)
    at createApp (file:///Users/arnauorriols/Library/Caches/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:30034:29)
    at run (file:///Users/arnauorriols/Library/Caches/deno/npm/registry.npmjs.org/create-next-app/14.2.15/dist/index.js:30528:27)
    at eventLoopTick (ext:core/01_core.js:175:7)
@littledivy littledivy added bug Something isn't working correctly node compat labels Oct 18, 2024
@littledivy
Copy link
Member

Caused by use of non-standard error.code property:

https://github.com/vercel/next.js/blob/e8e1eb97183c68b3adfcec84984a0a040e008be7/packages/create-next-app/create-app.ts#L68-L71

    try {
      repoUrl = new URL(example)
    } catch (error: unknown) {
      const err = error as Error & { code: string | undefined }
      if (err.code !== 'ERR_INVALID_URL') {
        console.error(error)
        process.exit(1)
      }
    }

littledivy added a commit to littledivy/next.js that referenced this issue Oct 18, 2024
This patch updates the error check for example URLs in `create-next-app` to use TypeError instead of
`error.code`.

`error.code` is a non-standard property present in Node.js, even for Web APIs like URL.

This fixes `create-next-app -e hello-world` on Deno. Ref denoland/deno#26383
@littledivy
Copy link
Member

Opened vercel/next.js#71473

@lucacasonato lucacasonato added the upstream Changes in upstream are required to solve these issues label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat upstream Changes in upstream are required to solve these issues
Projects
None yet
Development

No branches or pull requests

3 participants