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.

npm run <dev|production> hangs after compilation before exiting

See original GitHub issue
  • Laravel Mix Version: 0.8.1
  • Node Version (node -v): v7.5.0
  • NPM Version (npm -v): 4.2.0
  • OS: Linux Hyperion 4.9.8-1-ARCH #1 SMP PREEMPT Mon Feb 6 12:59:40 CET 2017 x86_64 GNU/Linux

Description:

After running npm run <dev|production>, while the actual compilation runs in a reasonable amount of time (~800ms for dev and ~4500ms for production), the process hangs for about 60 seconds before returning to the command prompt.

$ time npm run production
> node node_modules/cross-env/bin/cross-env.js NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules

 95% emitting                                                                        

 DONE  Compiled successfully in 4475ms
[table omitted to save space]

real	0m55.700s
user	0m6.077s
sys	0m0.157s

This has been the case since at least 0.5.x I believe.

Obviously it’s likely some strange interaction with my terminal config with webpack, since I haven’t seen any other complaints about this, but I haven’t been able to figure out a root cause so I figured I’d open an issue about it.

Steps To Reproduce:

  1. $ time npm run production
  2. Observe the time data

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bitdaggercommented, Feb 17, 2017

Yes! It was related to notifications.

mix.disableNotifications() allows for an exit to console immediately after compilation finishes.

I’m still not sure why notifications cause the process to hang on my machine, but this is a good workaround in the meantime.

Edit: After installing the notify-osd package on my system via package manager, no more hanging even with notifications enabled. Might want to drop a note in the docs here that the package (or a similar notification-server) is required if notifications are enabled. Or maybe I’m just the odd man out, haha.

Double Edit: After looking into this some more, it appears that the notification-server I was using (xfce4-notifyd) was failing to display notifications, with a timeout error. The issue is probably related to the node-notify plugin correctly calling to the notification-server, but getting the same timeout and blocking until the error triggered, then continuing silently.

The Rare Triple Edit: I was able to fix the issue by adding the following line to my ~/.xinitrc file

source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh

Thanks to @kohenkatz for the suggestion to look into notifications.

1reaction
fahmiegertoncommented, Oct 8, 2021

I still got this problem, adding mix.disableNotifications() didn’t resolve it 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run <dev|production> hangs after compilation before exiting
After running npm run <dev|production> , while the actual compilation runs in a reasonable amount of time (~800ms for dev and ~4500ms for ......
Read more >
npm run dev (or production) stops at setup with no errors
Hi. I have a laravel project and am using laravel mix for transpiling js and scss. Everything works fine on my local machine...
Read more >
Webpack builds successfully, but hangs without exiting
I spawn the process via npm run build , the client.js is correctly built, but the webpack build process never terminates. webpack.
Read more >
react-app-rewired - npm
Start using react-app-rewired in your project by running `npm i ... for compiling your react app in development or production mode.
Read more >
DigitalOcean App, Laravel, npm run production fails
Are there any fixes to npm run prod fails on build? I would like to add this to ensure what is on the...
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