Error: Importing "@vercel/next": require() when building from Git

Hello, I have been toying with a NextJS app locally and decided to rename it. I wanted to setup git build. So I renamed the project name, and tried to connect it through GitHub. However, the build is failing. Running the following command works on my device (tm). Before this I was deploying from my computer without any problems. Cloudflare builds do not work unfortunately. I tried to use npm instead of bun, change the node_version, etc. Still nothing. (When I do Retry build.) The build error seems fairly weird and I am not sure how to proceed. EDIT: My build ID is eb331fe9-c68e-4f84-b94d-10e59be881f8
No description
8 Replies
James
James8mo ago
This build error is happening while Vercel is building your Next.js app, so I'm afraid I'm not sure what we could really do to help... Maybe you're not supposed to import that lib in your app? Not sure tbh, I haven't heard of an error about importing that before. If you're not importing it yourself, maybe try pinning an earlier version of the Vercel CLI? Sorry, not a very helpful reply - I know.
vojtechp
vojtechp8mo ago
I don't think I am importing this on purpose. I used the CF pages-on-next template from the CLI. Although I had some issues making it run and i might have had broken something. I'll try previous version
James
James8mo ago
Hmm, odd, yeah, please do try pinning an older version of the Vercel CLI. In either case, there won't be much we can do about this since it happens during the Next.js build process
vojtechp
vojtechp8mo ago
Just a quick question. The vercel package is required by next-on-pages?
James
James8mo ago
Yes. We use it to build your application, and then we process its output to create the worker and static assets for your app
vojtechp
vojtechp8mo ago
I tried 33.5.1 for Vercel without any changes EDIT: 33.4.1 is not working either I'm gonna try older version. I tried local build again and it works It seems like it's some mismatch between the build environments
chunlea
chunlea8mo ago
I also found that npm works, but bun not working in this case Any updates? 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.
chunlea
chunlea8mo ago
GitHub
[🐛 Bug]: Error: Importing "@vercel/next": require() of ES Module ·...
next-on-pages environment related information System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Jan 12 22:40:34 PST 2024; root:xnu-10063.100.610.0.2~19/RELEASE_ARM64_T...
Want results from more Discord servers?
Add your server