Running Vercel CLI 43.2.0, not using Corepack. The app itself is an express web server.
I’m running into an issue where vercel dev in local isn’t using npm and instead tries to use yarn. I don’t have a yarn.lock and I have a package-lock.json. However, when I make a push to prod it does use npm somehow.
I have also tried adding npm install as the Install Command in the vercel UI settings, but that it still doesn’t seem to be working either. I only have this one project so I don’t think it’s being connected to any other instance. I assume that the Install Command would override whatever local commands there are.
The vercel dev command automatically detects your package manager based on lock files in your project. But a few other configuration options could interfere with that.
Here are a few things to check:
Make sure there’s no yarn.lock file in your project root or any parent directories
Make sure there is a package-lock.json file in your project root
Update to the latest version of the CLI, currently 43.3.0, by running npm i -g vercel@latest
Check if you have a vercel.json with and installCommand that might be forcing yarn
Please give that a try and let me know how it goes
It must be some weird issue bc I followed all these steps and still not working. I also tried running vercel dev on a diff project and it installed npm but not for this one somehow
I wasn’t able to replicate this error with my projects. There may be something, like a package dependency, that’s causing this with your project. Does this happen when you try to run other projects?
Solution: Remove the conflicting “dev” script from package.json
I had the same issue and found the root cause! The problem was having a "dev": "vercel" script in my package.json that was causing a conflict.
The Issue
When you have this in your package.json:
"scripts": {
"dev": "vercel", // <-- This causes the yarn fallback
"build": "echo 'Static files ready'",
"deploy": "vercel --prod"
}
Running vercel dev creates a circular dependency because the CLI tries to run npm scripts, finds the “dev” script that calls “vercel”, and falls back to yarn detection.
The Fix
Simply remove or rename the conflicting “dev” script:
I’m hosting static files and most of my setup was generated using Claude Code, which is why it took me a while to identify this issue. Hope this helps others who run into the same problem!