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

Support for create-svelte #21024

Closed
littledivy opened this issue Oct 31, 2023 · 2 comments · Fixed by #21026
Closed

Support for create-svelte #21024

littledivy opened this issue Oct 31, 2023 · 2 comments · Fixed by #21026
Labels
bug Something isn't working correctly node compat

Comments

@littledivy
Copy link
Member

Originally reported in #17248

I built deno from main branch and this gave the below error

h7kanna@Harshas-MBP ~ % ./Repos/crates/deno/target/release/deno run -A --unstable --reload npm:create-svelte@latest sveltekit-deno

create-svelte version 5.1.1

┌  Welcome to SvelteKit!
│
◆  Which Svelte app template?
│  ● Skeleton project (Barebones scaffolding for your new SvelteKit app)
│  ○ SvelteKit demo app
│  ○ Library project
└
error: Uncaught Error: The _read() method is not implemented
    at ReadStream.Readable._read (ext:deno_node/_stream.mjs:3101:13)
    at ReadStream.Readable.read (ext:deno_node/_stream.mjs:2997:16)
    at resume_ (ext:deno_node/_stream.mjs:3347:16)
    at Array.processTicksAndRejections (ext:deno_node/_next_tick.ts:33:15)
    at eventLoopTick (ext:core/01_core.js:180:29)

During the implementation of node:tty we had to make a tradeoff wherein tty.ReadStream and tty.WriteStream were made to extend a Duplex instead of a net.Socket because it introduced circular dependencies at snapshot-time. In Node.js, this problem is solved by using a require at runtime:

switch (getHandleType(fd)) {
  // ...
  case "TTY": {
    const tty = require("tty");
    return tty.ReadStream(fd);
  }
}
@littledivy littledivy added bug Something isn't working correctly node compat labels Oct 31, 2023
@benmccann
Copy link

Thanks! The usage of these APIs in create-svelte comes from @clack/prompts, so I'd guess that there's going to be a number of other frameworks affected, which use that library as well. I just had a quick look, so there easily could be more, but I found a few that just got closed and I wonder if they're actually fixed. These look to me like they could potentially be affected as well:

@littledivy
Copy link
Member Author

Thanks, re-opened them

littledivy added a commit that referenced this issue Oct 31, 2023
Workaround the circular references issue by using a initializer function
to give tty stream class to `initStdin`.

Fixes #21024
Fixes #20611
Fixes #20890
Fixes #20336

`create-svelte` works now:
```
divy@mini /t/a> ~/gh/deno/target/debug/deno run -A --unstable --reload npm:create-svelte@latest sveltekit-deno

create-svelte version 5.1.1

┌  Welcome to SvelteKit!
│
◇  Which Svelte app template?
│  Skeleton project
│
◇  Add type checking with TypeScript?
│  Yes, using JavaScript with JSDoc comments
│
◇  Select additional options (use arrow keys/space bar)
│  none
│
└  Your project is ready!

✔ Type-checked JavaScript
  https://www.typescriptlang.org/tsconfig#checkJs

Install community-maintained integrations:
  https://github.com/svelte-add/svelte-add

Next steps:
  1: cd sveltekit-deno
  2: npm install
  3: git init && git add -A && git commit -m "Initial commit" (optional)
  4: npm run dev -- --open

To close the dev server, hit Ctrl-C

Stuck? Visit us at https://svelte.dev/chat
```

---------

Signed-off-by: Divy Srivastava <[email protected]>
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants