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

Broken build - "stdin" is not exported by unenv #269

Open
Mehdi-Hp opened this issue Oct 6, 2024 · 5 comments
Open

Broken build - "stdin" is not exported by unenv #269

Mehdi-Hp opened this issue Oct 6, 2024 · 5 comments

Comments

@Mehdi-Hp
Copy link

Mehdi-Hp commented Oct 6, 2024

Not sure if it's directly from @nuxt/icon or a dependency breaking change, but build breaks as soon as you add @nuxt/icon to modules. develop works okay.

Downgrading unenv or using the nightly version didn't help.

To reproduce:

  1. pnpx nuxthub init test-app
  2. pnpx nuxi module add icon
  3. pnpm build

Logs:

[nitro 3:07:35 PM]  ERROR  RollupError: node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/prompt-BuYSwD7c.js (1:9): "stdin" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/process/index.mjs", imported by "node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/prompt-BuYSwD7c.js".


1: import { stdin, stdout } from "node:process";
            ^
2: import f from "node:readline";
3: import { WriteStream } from "node:tty";


[3:07:35 PM]  ERROR  node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/prompt-BuYSwD7c.js (1:9): "stdin" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/process/index.mjs", imported by "node_modules/.cache/nuxt/.nuxt/dist/server/_nuxt/prompt-BuYSwD7c.js".

  at getRollupError (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
  at error (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:388:42)
  at Module.error (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13971:16)
  at Module.traceVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14419:29)
  at ModuleScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:12121:39)
  at ChildScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7467:38)
  at ClassBodyScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7467:38)
  at ChildScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7467:38)
  at ChildScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7467:38)
  at FunctionScope.findVariable (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7467:38)
  at Identifier.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:6941:40)
  at AssignmentPattern.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4808:23)
  at Property.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4808:23)
  at ObjectPattern.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4804:28)
  at FunctionExpression.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4804:28)
  at MethodDefinition.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4808:23)
  at ClassBody.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4804:28)
  at ClassDeclaration.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4808:23)
  at Program.bind (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4804:28)
  at Module.bindReferences (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13950:18)
  at Graph.sortModules (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20201:20)
  at Graph.build (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20105:14)
  at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
  at async node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20751:13
  at async catchUnfinishedHookActions (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20258:16)
  at async rollupInternal (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20746:5)
  at async _build (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/nitropack/dist/nitro.mjs:2633:20)
  at async node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_ybhcnuqrdhnlo4pjzrhb752cba/node_modules/nuxt/dist/index.mjs:3630:5
  at async build (node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_ybhcnuqrdhnlo4pjzrhb752cba/node_modules/nuxt/dist/index.mjs:5778:3)
  at async Object.run (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/build.mjs:102:5)
  at async runCommand$1 (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.b8b195e1.mjs:1648:16)
  at async runCommand$1 (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.b8b195e1.mjs:1639:11)
  at async runMain$1 (node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.b8b195e1.mjs:1777:7)

  • Operating System: Darwin
  • Node Version: v22.9.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: -
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -
@arnauddoub
Copy link

I have the same problem but it seems to be linked to the Cloudflare preset

@Mehdi-Hp
Copy link
Author

Mehdi-Hp commented Oct 9, 2024

Any suggestions on what I should downgrade for now? I tried downgrading unenv and @nuxthub/core, but no luck.

@mathieunicolas
Copy link

mathieunicolas commented Oct 9, 2024

Interesting. I have a project with Nuxt/Content/UI/NuxtHub, everything up-to-date.
I use nuxt-icon "behind" nuxt-ui because it is used by nuxt-ui, but the module itself is not declared in the nuxt.config.ts in the root of my peoject. I've built a lot of versions of my project, where I use icons, without any problem.

2 days ago I tried to fix the problem described in #259 by installing local collections and adding an icon entry in my nuxt.config.ts with #259 (comment) because I don't like the fact the icons won't load, it's definitely not a normal behaviour.

After this step, I encountered the issue described here. I spent 1-2 hours trying to understand how/why, because there was no reason to incriminate nuxt-icon (I don't build after each commit and npm run dev was running fine). The fact it's because of nuxt-icon was definitely not obvious to me since I "just installed few icon collections and added options to nuxt-icon".

Hope this will help. You can try building with nuxt-ui and without nuxt-icon in your modules, I think you will be able to build your project... looks like when nuxt-icon is behind nuxt-ui proxy, everything works fine.

My 2 cents

edit : well, nope, I just applied again everything I said before and now the build is ok

  • I added "@nuxt/icon" to the modules list
  • I downloaded the icons collection
  • I created the icon entry in nuxt.config.ts with clientBundle.scan : true and sizeLimitKb: 256

Now I'm lost 🥳

@miqlangelo
Copy link

miqlangelo commented Oct 13, 2024

I have recently encountered the same problem when the Nitro presets are set on cloudflare-pages. If I remove the Nuxthub module, I can build my project without any issues. I'm using Nuxt UI without integrating any extra @nuxt/icon.

With npm, I can build the application as usual.

It's strange that I only have this problem in new projects. I can still build old projects with Hub/UI error-free using pnpm. However, when I copy everything from those into a new application, I get the "stdin is not exported" error again.

Unfortunately, adding @nuxt/icon did not help.

node: 20.18.0
pnpm: 9.12.1
nuxt: 3.13.2

@Barnabas
Copy link

Sadly, adding an .npmrc file with shamefully-hoist = true seems to fix it.

Found via: harlan-zw/nuxt-seo#218 (comment)

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

No branches or pull requests

5 participants