webpack: `webpack --watch` builds only once and exits immediately without even any warnings&errors.

webpack --watch builds only once and then exits immediately. However, It should keeps running and listening to fs changes for recompilation as expected.

I cannot see any errors or warnings even if I enable the verbose mode by:

webpack --watch --display-error-details --display-reasons

Below is my environment infomation:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty

$ uname -a
Linux ubuntu 3.19.0-56-generic #62~14.04.1-Ubuntu SMP Fri Mar 11 11:03:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ node -v
v4.4.1

$ npm -v
2.14.20

$ which node
~/.nvm/versions/node/v4.4.1/bin/node

$ which webpack  # Version: webpack 1.12.14
./node_modules/.bin/webpack

$ npm ls --depth=0
├── css-loader@0.23.1
├── exports-loader@0.6.3
├── file-loader@0.8.5
├── handlebars@4.0.5
├── handlebars-loader@1.2.0
├── handlebars-template-loader@0.5.7
├── image-webpack-loader@1.6.3
├── iscroll@5.2.0
├── node-sass@3.4.2
├── normalize.css@4.0.0
├── raw-loader@0.5.1
├── sass-loader@3.2.0
├── style-loader@0.13.1
├── vue@1.0.20
├── webpack@1.12.14
├── zepto@1.0.1
└── zepto-modules@0.0.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 13
  • Comments: 25 (2 by maintainers)

Most upvoted comments

Try this workaround:

Add this to your webpack configuration file:

watchOptions: { poll: true },

Works for me on Ubuntu on Windows.

Lahdo posted that here

@wonderbeyond,

This sounds like an inotify file watch limit issue? Here is a helpful wiki article from @guard that may help.

Perhaps webpack shouldn’t fail silently when it runs out of watches?

@artburkart Many thanks! Setting fs.inotify.max_user_watches solves my problem.

Perhaps webpack shouldn’t fail silently when it runs out of watches?

Yes, I agree!

Why is this issue closed? This happened to me on Ubuntu 18.04 using webpack 4.19.0. This was a completely maddening issue that cost me a solid hour of banging my head against the wall, because webpack exited 0 with no debug or error information. In my case, it only exited when I used it under concurrently when running with another (Python) development server that also used inotify watches.

The solution, for me, was to run this:

$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

But… the root issue here isn’t my system; it is, instead, that webpack is not reporting that it has run out of inotify watches; instead, it is just silently exiting.

Just noticed “If you think this is still a valid issue, please file a new issue with additional information.” by the webpack bot, so opened a new issue, #8101.

Hi,

I noticed same problem But after researching i found that it’s not bug If filesystem is mounted with noatime option (this option is recommended in many sources for SSD disks as optimization) this plugin deoesn’t work as webpack --watch (only webpack --watch-poll --watch) So i recommend to check /etc/fstab file in Linux (Unix) and remove noatime if you have and reboot

Same problem and resolving for webpack-dev-server too! I think you need to update docs about this.

Had the same issue in Ubuntu.

For me it worked if I added the -d option: “webpack -d --watch”