Open willin opened 6 months ago
Hi, Can you try to add this thing to package.json?
{
"name": "@package/name",
"resolutions": { "string-width": "4.2.3" }
...
}
Add "resolutions": { "string-width": "4.2.3" }
into package.json
works for me, but I had to delete node_module and bun.lockb file, then run bun install
again. No need to add string-width
in depencencies.
I think this is a bug in Bun. Can you open an issue in Bun's github repo?
There is already a bug report in bun: https://github.com/oven-sh/bun/issues/7539
The issue has been fixed in bun v1.1.4, looks like this can be closed.
I'm also experiencing this error using yarn, adding "resolutions": { "string-width": "4.2.3" } hasn't resolved the issue for me.
Upgrading the vercel dev dependency to 34 solved the issue for me.
I'm still having issues using Bun 1.1.4 trying to build an Angular 17 application with Karma for testing. The first issue was with string-width
requiring strip-ansi
which was resolved by using "overrides": { "string-width": "6.1.0" }
but then I get the next error which I can't provide an override for as it's on latest already
>bun run build
$ ng build core
Unknown error: Error [ERR_REQUIRE_ESM]: require() of ES Module C:\dev\project\node_modules\string-width\index.js from C:\dev\project\node_modules\cliui\build\index.cjs not supported.
Instead change the require of index.js in C:\dev\project\node_modules\cliui\build\index.cjs to a dynamic import() which is available in all CommonJS modules.
error: script "build" exited with code 127
Just noticed this from the log, I believed cloudflare need to bump their bun version in deployment runtime to fix it. The current bun version still 1.0.1.
01:58:16.359 | Found wrangler.toml file. Reading build configuration...
-- | --
01:58:16.364 | pages_build_output_dir: .vercel/output/static
01:58:16.365 | Build environment variables: (none found)
01:58:16.468 | Successfully read wrangler.toml file.
01:58:16.614 | Detected the following tools from environment: bun@1.0.1, nodejs@18.17.1
01:58:16.615 | Installing project dependencies: bun install --frozen-lockfile
01:58:16.844 | bun install v1.0.1 (31aec4eb)
01:58:21.667 | + @cloudflare/next-on-pages@1.11.3
Also followed https://developers.cloudflare.com/pages/configuration/language-support-and-tools/#v2-build-system ,fixed it by manually set up BUN_VERSION
to latest version(1.1.9) and redeploy.
If you're using npm, adding this to my package.json fixed it for me:
"overrides": { "string-width": "4.2.3" },
I have the same issue, in local environment. I’m using yarn.
I had "vercel": "^35.2.1"
, I tried to upgrade to 35.2.3, but what fixed it was to downgrade towards `"vercel": "^34".
next-on-pages environment related information
Description
success on local development but errored on cloudflare pages deployment.
Local Logs
Remote Logs
Reproduction
https://github.com/willin/nextjs-stripe-cloudflare
Pages Deployment Method
Pages CI (GitHub/GitLab integration)
Pages Deployment ID
1a220fe3-8824-43cb-8da1-235a74b16e01
Additional Information
Just a new project with a
stripe
packge.Would you like to help?