Docker: Error at build(Cannot find module 'typescript') version 4.3.2

System Information
  • Strapi Version: 4.3.2
  • Operating System:
  • Database: postgres
  • Node Version: strapi/base:alpine and strapi/base:latest
  • NPM Version: 8.9.0
  • Yarn Version:

I have this error at docker build but only with versions >4.3.0, i had been able to build with this same dockerfile and strapi version 4.2.3, i’m not sure about what to add in the dockerfile.


Thanks for your time.

2 Likes

I had the same issue and found your thread.
For my case it was because local node-version was different from my target server.
I had local nodejs 16 but the target server was on 12.

Did you manage to fix the issue? I’ve got the same one. Trying to deploy to railway with TypeScript and I can’t even get the base app to build properly.

You have to set the node env and node version like so in Railway:

NODE_ENV=production
NIXPACKS_NODE_VERSION=18.x

Works for me now

Edit: still had some problems, ‘pg’ package was not found, can be fixed by running npm install pg --save and push to your repo