[SOLVEDS] Build fails for a React app with Snowpack and PostCSS

Hi,

I’m trying to deploy a simple React app which I made with Snowpack. I can build it locally but in Render I get this error:

    ==> Running build command 'npm run build'...
    Jan 26 10:59:45 PM  
    Jan 26 10:59:45 PM  > @ build /opt/render/project/src
    Jan 26 10:59:45 PM  > snowpack build
    Jan 26 10:59:45 PM  
    Jan 26 10:59:48 PM  [snowpack] ! building source files...
    Jan 26 10:59:48 PM  [snowpack] ✘ file:///opt/render/project/src/src/index.css
    Jan 26 10:59:48 PM    Error: Command failed with ENOENT: postcss
    Jan 26 10:59:48 PM  spawn postcss ENOENT
    Jan 26 10:59:48 PM      at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    Jan 26 10:59:48 PM      at onErrorNT (internal/child_process.js:465:16)
    Jan 26 10:59:48 PM      at processTicksAndRejections (internal/process/task_queues.js:80:21)
    Jan 26 10:59:48 PM  npm ERR! code ELIFECYCLE
    Jan 26 10:59:48 PM  npm ERR! errno 1
    Jan 26 10:59:48 PM  npm ERR! @ build: `snowpack build`
    Jan 26 10:59:48 PM  npm ERR! Exit status 1
    Jan 26 10:59:48 PM  npm ERR!
    Jan 26 10:59:48 PM  npm ERR! Failed at the @ build script.
    Jan 26 10:59:48 PM  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    Jan 26 10:59:48 PM  
    Jan 26 10:59:48 PM  npm ERR! A complete log of this run can be found in:
    Jan 26 10:59:48 PM  npm ERR!     /opt/render/.cache/_logs/2021-01-27T01_59_48_528Z-debug.log
    Jan 26 10:59:48 PM  ==> Build failed 😞 

It seems it’s looking for index.css in file:///opt/render/project/src/src/index.css instead of in file:///opt/render/project/src/index.css? I’m not sure… the project also uses Tailwind and PostCSS.
Here is the repo GitHub - livchits/image-search: An Image Search App using Unsplash’s API.

Thanks in advance for any help.

Well, finally I found the problem: the build process need postcss-cli package. The funny (?) thing is that the build was succesful locally even though postcss-cli wasn’t installed in the project neither as a global package.

1 Like