← All articles

· 1 min read

DigitalOcean error tsc: not found on Node App

Frustrated woman biting a pencil while looking at her laptop

Photo by JESHOOTS.COM on Unsplash

My deployment was working fine on the App solution from DigitalOcean, but from one day to another, I did one commit to main branch and my deployment stopped to work.

I have not updated anything on my packeage.json, but deployment was no more working.

What was the problem

The problem is that TypeScript was not being installed on the build phase. And after some fails I realized that it started because a have setted a new environment varibale NODE_ENV = production.

After it, the npm install command was installing only for production, but my TypeScript stuff are declared in devDependencies.

Because of that the error started with no changes on my code. Because the change happened on my production settings.

Solution

I customized the npm run build command to install all the dependecies, do the build, and then prune the dev ones.

npm install --production=false && npm run build && npm prune --production

← All articles