Hi, I’m using Next on Netlify to deploy a website but getting the following error
It looks like you’re trying to use TypeScript but do not have the required package(s) installed.
3:16:54 PM: Please install typescript by running:
3:16:54 PM: yarn add --dev typescript
3:16:54 PM: If 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).
Welcome to the Netlify Forums! Sorry to hear you are encountering an unexpected behaviour. We will need a bit more information to dig in here. Can you please share your site name and your repo?
The instruction in the error message does include the --dev flag, so a devDependency should work fine? I’m not sure that there would be any difference in this context?
devDependencies are those required as part of the development workflow, as opposed to dependencies which are required when running your code (in-depth explanations Types of dependencies | Yarn )
I have a project that was deploying fine with a single .ts file used as a middleware. The tsconfig.json was present for the last couple dozen builds with no issue. In the most recent set of deploys they have failed with the same error at the beginning of this thread. I followed the suggestions of installing the dependancies not just as devdependancies but both. Still no luck. Builds locally fine with no issues. Are there any other suggestions?
For anyone landing here from a search: in my case, I had set a NODE_ENV=production environment variable in my deploy settings. Removing it caused the site to build with no issues.