command-lineparcel

Why terminal becomes unresponsive after Parcel build?


I am following Parcel's "Building a web app with Parcel" to learn how to use it. The problem arises after I type in npx parcel src/index.html. The build runs fine and I can see the development server results just fine. The terminal becomes unresponsive afterwards. I can't type, quit, or anything. The only workaround is killing the terminal and restarting...which is very annoying. I've looked for answers, I've updated Node to the latest version, but to no avail. This doesn't happen when I use Webpack or any other time. Here is a screen shot just in case that helps. Could someone please help this unworthy noob out? Screen shot of terminal and VSCode


Solution

  • When you just run npx parcel, it starts a development server that will continue to run until you exit. This development server will watch for changes that you make as you develop and will reload your project, so you don't need to restart/rebuild every time you make changes.

    The reason you can't type anything into the terminal (or, at least, that the terminal doesn't respond when you do) is that the development server is still running in that terminal. You have to exit the development server before the terminal prompt will re-appear and you can use it as normal.

    To exit any program running in a terminal, you can type Control+C (hold down the Control key and hit the "c" key). This works for any terminal program, not just parcel. This will exit the development server program and you'll get your terminal prompt back.

    There are other things you can do with programs (or "jobs") in the terminal window. You can read more about them here and here.

    But you should use the development server to your advantage. Keep it running while you work. If you need to use the terminal while it's running, just open up another terminal window.

    When you finally want to build your app/site, run parcel build instead.

    You can read more about all of this here: https://parceljs.org/getting-started/webapp/