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 Nuxt/Nuxi #20336

Closed
birkskyum opened this issue Aug 31, 2023 · 8 comments · Fixed by #20892 or #21026
Closed

Support Nuxt/Nuxi #20336

birkskyum opened this issue Aug 31, 2023 · 8 comments · Fixed by #20892 or #21026
Assignees
Labels
bug Something isn't working correctly node compat

Comments

@birkskyum
Copy link
Contributor

Tried to generate a repo for Nuxt, but got this:

~/repos/deno-kitchensink via 🦕 v1.36.3 
➜ deno run -A npm:nuxi@latest init my-app       


 ERROR  Not implemented: net.Socket.prototype.constructor with fd option                            5:24:20 PM

  at notImplemented (ext:deno_node/_utils.ts:9:9)
  at new Socket (node:net:455:7)
  at new WriteStream (node:tty:18:8)
  at ED.prompt (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/chunks/prompt.mjs:138:676)
  at select (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/chunks/prompt.mjs:297:6)
  at Module.prompt (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/chunks/prompt.mjs:407:18)
  at /Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/shared/nuxi.57fa43de.mjs:1316:71
  at async Object.run (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/chunks/init.mjs:8472:36)
  at async runCommand$1 (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/shared/nuxi.57fa43de.mjs:1644:5)
  at async runCommand$1 (/Users/admin/Library/Caches/deno/npm/registry.npmjs.org/nuxi/3.7.3/dist/shared/nuxi.57fa43de.mjs:1638:7) 



 ERROR  Not implemented: net.Socket.prototype.constructor with fd option                            5:24:20 PM
@bartlomieju bartlomieju added bug Something isn't working correctly node compat labels Aug 31, 2023
@bartlomieju
Copy link
Member

Thanks for the report @birkskyum, do you happen to know if that is coming from some library? I believe I hit the same problem when checking support for latest SvelteKit (#17248 (comment)). Since the stack trace says it's coming from a file named prompt.mjs I'm wondering if there's some hacky behavior going on that creates a Socket for fd 1 (stdin). If that's the case we can special case that somehow in our polyfill.

@birkskyum
Copy link
Contributor Author

birkskyum commented Aug 31, 2023

Based on the sveltekit ticket, it sounds like it's related to tty, which is used in almost all of thes npm:create-x packages that nearly all the frameworks use.

@birkskyum
Copy link
Contributor Author

birkskyum commented Aug 31, 2023

The error in prompt.mjs appear here, but what is wrong with the WriteStream i don't know:

const u=new WriteStream(0);
        ^

@benmccann
Copy link

If you want to try to create a smaller reproduction, SvelteKit uses @clack/prompts: https://github.com/sveltejs/kit/blob/c9a99b6c911c2ea9c919946aaada4f44293bdb75/packages/create-svelte/package.json#L15

@bartlomieju
Copy link
Member

Thank you @benmccann!

@ayame113
Copy link
Contributor

I was able to reproduce the error using @clack/core. Seems like the same problem as #6529.

import { Prompt } from "npm:@clack/core"

new Prompt({render() {}}).prompt()
> deno run --allow-read test.ts  
error: Uncaught Error: Not implemented: net.Socket.prototype.constructor with fd option
    at notImplemented (ext:deno_node/_utils.ts:9:9)
    at new Socket (node:net:455:7)
    at new WriteStream (node:tty:18:8)
    at h.prompt (file:///C:/Users/ayame/AppData/Local/deno/npm/registry.npmjs.org/@clack/core/0.3.3/dist/index.mjs:9:693)
    at file:///C:/Users/ayame/work/study/.../test.ts:3:27

@benmccann
Copy link

In case anyone's interested about what's on line 9 column 693, it's:

Screenshot from 2023-09-15 10-43-27

Which is defined as:

Screenshot from 2023-09-15 10-44-47

This does indeed look the same as #6529 as you can see one of the comments there mentioning this library and API call specifically.

@bartlomieju bartlomieju self-assigned this Oct 1, 2023
@rracariu
Copy link

rracariu commented Oct 6, 2023

Using normal npm installation create an app then try to use deno task dev:

Warning Currently only basic package.json `scripts` are supported. Programs like `rimraf` or `cross-env` will not work correctly. This will be fixed in an upcoming release.
Task dev nuxt dev
Nuxt 3.7.4 with Nitro 2.6.3                                                                9:15:39 AM

 ERROR  Cannot read properties of undefined (reading 'env')                                9:15:40 AM

  at data::3:25
  at data::19:4
  at evalModule (node_modules/.deno/jiti@1.20.0/node_modules/jiti/dist/jiti.js:1:255868)
  at Object.jiti (node_modules/.deno/jiti@1.20.0/node_modules/jiti/dist/jiti.js:1:253796)
  at resolveConfig (node_modules/.deno/@nuxt+kit@3.7.4/node_modules/c12/dist/index.mjs:280:24)
  at loadConfig (node_modules/.deno/@nuxt+kit@3.7.4/node_modules/c12/dist/index.mjs:116:40)
  at async loadNuxtConfig (node_modules/.deno/@nuxt+kit@3.7.4/node_modules/@nuxt/kit/dist/index.mjs:2530:18)
  at async Object.run (node_modules/.deno/nuxt@3.7.4/node_modules/nuxi/dist/chunks/dev.mjs:174:25)
  at async runCommand$1 (node_modules/.deno/nuxt@3.7.4/node_modules/nuxi/dist/shared/nuxi.9d864d83.mjs:1647:7)
  at async runCommand$1 (node_modules/.deno/nuxt@3.7.4/node_modules/nuxi/dist/shared/nuxi.9d864d83.mjs:1638:11) 



 ERROR  Cannot read properties of undefined (reading 'env')
deno 1.37.1 (release, aarch64-apple-darwin)
v8 11.8.172.3
typescript 5.2.2

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
6 participants