-
Notifications
You must be signed in to change notification settings - Fork 22
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
Buid giving the error in cloudflare-pages
preset
#129
Comments
cloudflare-pages
preset
Thanks for reporting! |
Hi @pi0 Updated the unenv version and now getting the following error. [nitro 8:53:38 PM] ERROR RollupError: "default" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/fs/promises/index.mjs", imported by "node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js".
4: import os from 'node:os';
5: import path from 'node:path';
6: import fsPromises from 'node:fs/promises';
^
7: import { EventEmitter } from 'node:events';
8: import { StringDecoder } from 'node:string_decoder';
ERROR "default" is not exported by "node_modules/.pnpm/[email protected]/node_modules/unenv/runtime/node/fs/promises/index.mjs", imported by "node_modules/.pnpm/[email protected]/node_modules/formidable/src/Formidable.js". 8:53:38 PM
at error (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
at Module.error (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:13604:16)
at Module.traceVariable (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:14029:29)
at ModuleScope.findVariable (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:12547:39)
at FunctionScope.findVariable (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
at ChildScope.findVariable (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
at MemberExpression.bind (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:9482:49)
at CallExpression.bind (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
at CallExpression.bind (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:9833:15)
at ReturnStatement.bind (node_modules/.pnpm/rollup@3.27.2/node_modules/rollup/dist/es/shared/node-entry.js:5850:23) |
Although this is not related to any recent change, seems something valid to be supported. Can you by any chances share me a reproduction? (i made fix in 37fd173 but need to make sure it is valid) |
Sure let me check and see if share you a reproduction. |
how can i checkout to this specific commit in my local and test it out. as my project is a private repo there are a lot of dependencies sorry unable to share a reproduction. If you are able to help me get into local will be able to test it out ASAP. Thanks. |
No worries if too much trouble on reproduction i will go ahead and directly release shortly. (i was mostly curious what dependencies are pulling this apis. until now, it was hidden issue because we used silent mocks) |
tried do in windows machine [nitro 11:40:11 PM] ERROR RollupError: "createHash" is not exported by "node_modules/unenv/runtime/node/crypto/index.mjs", imported by "node_modules/.pnpm/[email protected]/node_modules/formidable/src/VolatileFile.js".
1: /* eslint-disable no-underscore-dangle */
2:
3: import { createHash } from 'node:crypto';
^
4: import { EventEmitter } from 'node:events';
[11:40:11 PM] ERROR "createHash" is not exported by "node_modules/unenv/runtime/node/crypto/index.mjs", imported by "node_modules/.pnpm/formidable@3.5.0/node_modules/formidable/src/VolatileFile.js".
at error (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
at Module.error (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13604:16)
at Module.traceVariable (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14029:29)
at ModuleScope.findVariable (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:12547:39)
at ChildScope.findVariable (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
at ClassBodyScope.findVariable (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38)
at ChildScope.findVariable (/C:/projects/<>/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:7082:38) getting the following error from windows i hope this also helps. |
Found the culprit import { readFiles } from "h3-formidable";
import * as fs from "fs"; For future reference for anyone did the following pnpm why unenv went through just the one are potential causes and tried it out during testing was writing the files to the local disk so was using h3-formidable that's what caused the issue. I am so sorry about the last issue. I appreciate the time and effort you put into every single commit. Cheer's |
hello @pi0, sorry for opening this issue again but I'm facing a related problem. I'm crafting an app to find places using nuxt, nitro, cloudflare pages, drizzle and planetscale. the dev env is working, but once I build, I got the following error:
some deps: "devDependencies": {
"@nuxtjs/tailwindcss": "6.8.0",
"drizzle-kit": "0.19.13",
"nuxt": "3.7.4",
},
"dependencies": {
"@planetscale/database": "1.11.0",
"drizzle-orm": "0.28.6",
} running
I guess I'm using the latest version of unenv. as the app is open source, you can check the repository. I don't know how to create a scenario to allow you to reproduce the behavior. could you help me? thanks |
@andrevandal Do you mind to reopen a new issue in nitro/nuxt with same description so not forget to check on this? 🙏🏼 |
sure, done: unjs/nitro#1821 |
same error different module ℹ Building Nitro Server (preset: cloudflare-pages) nitro 9:43:40 PM [nitro 9:43:41 PM] ERROR Error: Cannot resolve "unenv/runtime/node/string_decoder/index/" from "D:\source\BP\webApps\app\node_modules\unzipper\node_modules\readable-stream\lib\_stream_readable.js" and externals are not allowed! undefined [9:43:41 PM] ERROR Cannot resolve "unenv/runtime/node/string_decoder/index/" from "D:\source\BP\webApps\app\node_modules\unzipper\node_modules\readable-stream\lib\_stream_readable.js" and externals are not allowed! at Object.resolveId (/D:/source/BP/webApps/app/node_modules/nitropack/dist/shared/nitro.4ea992bc.mjs:1973:17) [9:43:41 PM] ERROR Cannot resolve "unenv/runtime/node/string_decoder/index/" from "D:\source\BP\webApps\app\node_modules\unzipper\node_modules\readable-stream\lib\_stream_readable.js" and externals are not allowed! error Command failed with exit code 1. |
Environment
Cloudflare-pages
Reproduction
NITRO_PRESET='cloudflare-pages' npm run build
Describe the bug
Unable to build in cloudflare-pages preset.
The same working with normal nodejs preset.
Can someone please guide me what is the issue and how to resolve this.
Additional context
Logs
No response
The text was updated successfully, but these errors were encountered: