Next.js ^14.2.3 build is throwing typescript, and sometimes eslint, error on vercel but locally it works fine. Its not that typescript or eslint fails but vercel does not have typescript/eslint package while building hence throws error:
It looks like you're trying to use TypeScript but do not have the required package(s) installed.Please install typescript by running: npm install --save-dev typescriptIf you are not trying to use TypeScript, please remove the tsconfig.json file from your package root (and any TypeScript files in your pages directory).For eslint, it also throws similar error stating something like:
Please install eslint by running: npm install --save-dev eslintTried multiple solutions which includes:
- Turning off typescript and lint while build by:
ignoreBuildErrors: truein next.config.js - Adding these packages before build by adding
prebuild: npm i typescriptin package.json - Removing node_modules and package-lock.json, reinstalling all packages and updating package-lock.json .
Project is no fancy - just a next.js app with environmental variables in Vercel config.
Current Behaviour: Throwing build error mentioned above Expected Behaviour: Should build successfully
I would appreciate a solution.