question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build script does not terminate on its own

See original GitHub issue

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Environment

  1. node -v: v7.10.1
  2. npm -v: 5.3.0 and 4.6.1
  3. yarn --version (if you use Yarn): 0.27.5
  4. npm ls react-scripts (if you haven’t ejected):

Steps to Reproduce

yarn build

Expected Behavior

yarn run v0.27.5
$ react-scripts build
Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  48.12 KB  build\static\js\main.9fdf0e48.js
  288 B     build\static\css\main.cacbacc7.css

The project was built assuming it is hosted at the server root.
To override this, specify the homepage in your package.json.
For example, add this to build it for GitHub Pages:

  "homepage" : "http://myname.github.io/myapp",

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

Done in 63.74s.

It terminates in some finite amount of time.

(Write what you thought would happen.)

Actual Behavior

The files are built but the built halts at the point:

The build folder is ready to be deployed.
You may serve it with a static server:

  yarn global add serve
  serve -s build

| 

It awaits for some input as the carat is there.

This was reproduced on my mac, windows and on Travis CI. I have also had it running on my machine, to make sure it just didn’t take a very long time, but it has been running for over two hour and still hasn’t stopped.

Interestingly, if you attempt to terminate the batch script

^CTerminate batch job (Y/N)?

Entering either Y or N will result in the script terminating.

Reproducible Demo

create-react-app my-app --scripts-version custom-react-scripts 
yarn build

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kitzecommented, Oct 15, 2017

Hey @hipertracker, new version is published now. Let me know if it’s fine!

2reactions
heltoncommented, Sep 30, 2017

I’m facing this problem too. As a workaround I followed the steps:

  • I installed timeout-cli and shelljs packages as dev dependencies
  • I changed my build script to: node build.js
  • I created a build.js file with the content below:
const shell = require('shelljs')

const successMessage = 'The build folder is ready to be deployed.'
const result = shell.exec('timeout react-scripts build -t 1m')

if (result.stdout.includes(successMessage))
  process.exit(0)
else
  process.exit(result.code)

This is definitely not a good solution, but it doesn’t hide any build issues and it makes sure the build script finally ends on its own. I can finally deploy to Netlify now.

The solution specified by @gr33k01 seems promising, but I haven’t tested it yet.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js Build.js script does not terminate
I have a legacy Vue.js project that used to be working fine. Recently when trying to build the project locally by running "npm...
Read more >
Prevent GNU screen from terminating session once ...
When you start a window without specifying a command, it is not "doing nothing". The "something" it is doing is running an interactive...
Read more >
[JENKINS-17116] graceful job termination
But cancelling a jenkins job seems to use SIGKILL. In this way the script cannot perform cleanup operations and free resources. SIGKILL cannot...
Read more >
How to Exit a Python script?
In this article, we will take a look at exiting a python program, performing a task before exiting the program, and exiting the...
Read more >
Stop or exit a PowerShell script when it errors
Unlike other programming languages, the PowerShell scripting language has two types of error scenarios: terminating and non-terminating.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found