Search code examples
deploymentvercel

Vercel 127 Error deploying vercel application


I'm trying to deploy on vercel, before it was working fine until I added a map library called leaflet and now it's giving an error in the deploy.. I tried to run npm run build in the terminal but still an error.

[10:00:20.566] Cloning github.com/daviroquedev/ride (Branch: master, Commit: 7e7d760)
[10:00:21.284] Cloning completed: 717.186ms
[10:00:21.853] Looking up build cache...
[10:00:22.163] Build Cache not found
[10:00:22.217] Running "vercel build"
[10:00:22.881] Vercel CLI 28.4.2
[10:00:23.187] Installing dependencies...
[10:00:23.831] npm ERR! must provide string spec
[10:00:23.834] 
[10:00:23.835] npm ERR! A complete log of this run can be found in:
[10:00:23.835] npm ERR!     /vercel/.npm/_logs/2022-09-27T13_00_23_618Z-debug-0.log
[10:00:23.850] Detected `package-lock.json` generated by npm 7+...
[10:00:23.850] Running "npm run build"
[10:00:24.243] 
[10:00:24.243] > [email protected] build
[10:00:24.244] > vite build
[10:00:24.244] 
[10:00:24.251] sh: vite: command not found
[10:00:24.259] Error: Command "npm run build" exited with 127

Build Failed Command "npm run build" exited with 127

PACKAGE.JSON

enter image description here


Solution

  • If you ever have any problems with building a npm project, it is always a good plan to try to re-install all packages.

    The first step should always be to simply run npm i.

    If this does not work, try to remove package-json.lock and delete .node_modules, before running npm i again.