vercel: create-react-app build on now fails

Hi. I’m trying to run ‘react-scripts build’ step in package.json scripts ‘now-build’ step. I’m getting the following error:

> ▲ npm run now-build
>
>   - index.js:47 Compiler.<anonymous>
>     [src]/[b6a523076d54485fee7b51e624a717feb64ba053]/index.js:47:40
>
> Error Error: Command react-scripts build ended with code 1
>     at ChildProcess.<anonymous> (/usr/lib/node_modules/@zeit/ace/build/lib/run.js:1:599)
>     at emitTwo (events.js:106:13)
>     at ChildProcess.emit (events.js:191:7)
>     at maybeClose (internal/child_process.js:877:16)
>     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Any suggestions on how to handle this?

Thanks in advance!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

It doesn’t ship with the a production webserver. And the start runs the dev server instead a production useable server…

So to deploy it you’ll need to npm run build to generate a minified bundle that may be deployed with ~any web server solution.

And then for example use serve to serve that static minified bundle:

npm i -S serve@3.1.0

and add now-start script:

{
  "start": "react-scripts start",
  "now-start": "serve build/",
  "build": "react-scripts build",
  "test": "react-scripts test --env=jsdom",
  "eject": "react-scripts eject"
}

Here is a full empty demo app https://react-app-demo-vygvkezcul.now.sh/_src (that I likely will one day accidentally delete…)

I’m happy to announce that the underlying issue with now has been finally fixed and react-create-apps can now again be deployed on now

Demo app here: https://react-create-app-demo-zqahqhmybz.now.sh/ and src here: https://react-create-app-demo-zqahqhmybz.now.sh/_src/?f=package.json

Apologies for the radio silence 😅

Thank you so much!