vercel / speed-insights

Vercel Speed Insights package
https://vercel.com/docs/speed-insights
Apache License 2.0
57 stars 9 forks source link

`Cannot find package 'vite'` on Vercel build only #46

Closed LauraBeatris closed 8 months ago

LauraBeatris commented 8 months ago

Description

Using Next.js 14.0.3 with Bun for dependencies management.

Following the documentation: https://vercel.com/docs/speed-insights/quickstart, I've installed the package and rendered the component in the layout module.

Running the build script on my local environment doesn't lead to compilation errors. However, when running the deployment on Vercel, getting the following error:

CleanShot 2024-01-20 at 19 00 30

Expected Behavior

Would expect to be able to just install the package, render the component as guided, and get the deployment working leading to analytics insights on my Vercel dashboard.

Related issues

Took a look at a current open issue and saw some mentions around Vite, not sure if it's related, but flagging it for the maintainers: https://github.com/vercel/speed-insights/issues/44

Icegreeen commented 8 months ago

I believe the problem is due to the fact that this version of node is not compatible with Vite in the Vercel environment.

Vite recommends node 18+ or 20+ (recommended)

This version difference may be causing difficulty in finding the 'vite' package during the build and deploy process on Vercel

huozhi commented 8 months ago

Hi @LauraBeatris we had a fix in 1.0.6, can you try to upgrade to see if it resolves your issue? Thanks

LauraBeatris commented 8 months ago

@huozhi Working now with the latest package version, thank you for fixing it in such a timely manner!