Is there a way to make v0 update package.json (for real)?

I found a wrong dependency ( “jsr:”: “supabase” ) that v0 added to package.json because I asked it to prepare the code to use on Supabase edge functions. If I try to deploy the application build fails.

I tried several times to ask v0 to remove the dependency but anytime I try to deploy it’s still there.
I am forced to manually update package.json locally anytime I need to deploy, because every new commit v0 make on my repo it will restore that broken dependency.

Davide

Hi, Davide! Welcome to the Vercel Community :waving_hand:

Thank you for sharing this! Could you also share a chat example for us?

Did you know you could also change the code directly from v0? You can then save it from there and future iterations should take that into account.

Hi Pauline,
nice to meet you.

Here you can find the whole chat:
https://v0.dev/chat/create-new-app-yUsIkfDsohy

I’m not sure if you can find my chat messages regarding package.json changes because I reverted to the previous version when it didn’t work.

As for manually editing the code, package.json was not visible in the v0 files at first (only in the attached repository).
When I asked to edit the file, it appeared. I manually edited it, but when I check the file in my github repository, it still has the wrong dependency.

Just before replying to you I tried again doing the following:

  • manually update package.json from v0 interface, saved
  • asked v0 to perform a change (add app version name in nav bar)
  • checked file: now the package.json in v0 still does not contain the wrong depedency
  • clicked “deploy” in order to trigger a push to my github repo
  • deployment failed with the same error that seems related to that wrong dependency:
 ERR_PNPM_FETCH_404  GET https://registry.npmjs.org/jsr%3A: Not Found - 404
This error happened while installing a direct dependency of /vercel/path0
jsr: is not in the npm registry, or you have no permission to fetch it.
No authorization header was set for the request.
Error: Command "pnpm install" exited with 1
  • now nor my repo and neither v0 package.json have that dependency, but the are different:

I ran into a similar issue. In my case the dynamically created package.json included a non-existing package called “https:”, which kept crashing the build. With a long workaround I was able to get my own package.json loaded into my v0 build and get it up and running again.
Steps:

  1. Let v0 generate the package.json and vercel.json files for you in the root dir
  2. Instruct v0 to copy the package.json to a subdirectory like mybuild/package.json
  3. Do some manual work to copy the dependencies v0 dynamically adds to package.json during the build (I took this from a previously failed build by checking the source) to your copy in mybuild/package.json (I asked ChatGPT to merge them for me)
  4. The magic: in the vercel.json manually modify the installCommand to this: “cp ./mybuild/package.json . && npm install —no-package-lock —legacy-peer-deps”. This copies your package.json to the root and makes sure the build continues with that one instead of the dynamically created one.

Hope that helps someone out there. Good luck!

Thank you Christian, tomorro I will try your workaround.
Hope it will solve the problem issue also in my project cause it’s frustrating having the need to keep changing package.json manually everytime.

PS: is there a way to make v0 push changes to github repo without publishing on Vercel every time?

Thank you,
Davide