"PostCSS not found" error during deployment of Express.js and Tailwind CSS app

I am creating an application that utilizes Express.js and Tailwind CSS. The application runs perfectly fine during local testing. However, when I attempt to deploy it, I receive an error message that says “postcss not found”. Even though postcss is listed as a dependency in the package.json file, the error still persists after I destroyed the builder machine and started anew. The problem emerged after I added Tailwind CSS, which requires postcss, to the project.


Recent Events
TIMESTAMP               TYPE            MESSAGE                         
2023-02-27T12:06:59Z    Received        Task received by client        
2023-02-27T12:07:22Z    Task Setup      Building Task Directory        
2023-02-27T12:07:35Z    Started         Task started by client         
2023-02-27T12:07:39Z    Terminated      Exit Code: 127                 
2023-02-27T12:07:39Z    Restarting      Task restarting in 1.079505213s
2023-02-27T12:07:45Z    Started         Task started by client         
2023-02-27T12:07:49Z    Terminated      Exit Code: 127                 
2023-02-27T12:07:49Z    Restarting      Task restarting in 1.144614247s
2023-02-27T12:07:55Z    Started         Task started by client         

2023-02-27T12:07:45Z   [info]Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755
2023-02-27T12:07:45Z   [info]Preparing to run: `npm run start` as root
2023-02-27T12:07:45Z   [info]2023/02/27 12:07:45 listening on [fdaa:0:7020:a7b:c988:5:40b2:2]:22 (DNS: [fdaa::3]:53)
2023-02-27T12:07:46Z   [info]> demo-server@1.0.0 start
2023-02-27T12:07:46Z   [info]> npm run build-css && npm run dev
2023-02-27T12:07:47Z   [info]> demo-server@1.0.0 build-css
2023-02-27T12:07:47Z   [info]> postcss public/styles.css -o public/build/styles.css
2023-02-27T12:07:47Z   [info]sh: 1: postcss: not found
2023-02-27T12:07:48Z   [info]Starting clean up.
2023-02-27T12:07:48Z   [info]Umounting /dev/vdc from /data
2023-02-27T12:07:53Z   [info]Starting instance
2023-02-27T12:07:53Z   [info]Configuring virtual machine
2023-02-27T12:07:53Z   [info]Pulling container image
2023-02-27T12:07:54Z   [info]Unpacking image
2023-02-27T12:07:54Z   [info]Preparing kernel init
2023-02-27T12:07:54Z   [info]Setting up volume 'sqlite3'
2023-02-27T12:07:54Z   [info]Opening encrypted volume
2023-02-27T12:07:54Z   [info]Configuring firecracker
2023-02-27T12:07:54Z   [info]Starting virtual machine
2023-02-27T12:07:55Z   [info]Starting init (commit: 08b4c2b)...
2023-02-27T12:07:55Z   [info]Mounting /dev/vdc at /data w/ uid: 0, gid: 0 and chmod 0755
2023-02-27T12:07:55Z   [info]Preparing to run: `npm run start` as root
2023-02-27T12:07:55Z   [info]2023/02/27 12:07:55 listening on [fdaa:0:7020:a7b:c988:5:40b2:2]:22 (DNS: [fdaa::3]:53)
2023-02-27T12:07:56Z   [info]> demo-server@1.0.0 start
2023-02-27T12:07:56Z   [info]> npm run build-css && npm run dev
2023-02-27T12:07:56Z   [info]> demo-server@1.0.0 build-css
2023-02-27T12:07:56Z   [info]> postcss public/styles.css -o public/build/styles.css
2023-02-27T12:07:56Z   [info]sh: 1: postcss: not found
2023-02-27T12:07:57Z   [info]Starting clean up.
2023-02-27T12:07:57Z   [info]Umounting /dev/vdc from /data
--> v10 failed - Failed due to unhealthy allocations - not rolling back to stable job version 10 as current job has same specification and deploying as v11 

--> Troubleshooting guide at https://fly.io/docs/getting-started/troubleshooting/
Error abort

What does the dependency section of your package.json look like?

What happens if you change your start command to:

NODE_ENV=production npm run build-css && npm run dev