webpack icon indicating copy to clipboard operation
webpack copied to clipboard

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

Open wonderbeyond opened this issue 10 years ago • 25 comments

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
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

wonderbeyond avatar Apr 08 '16 03:04 wonderbeyond

@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 avatar Apr 25 '16 17:04 artburkart

@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!

wonderbeyond avatar Apr 26 '16 01:04 wonderbeyond

I am running on lastest ubuntu support on windows 10

wangxi@WANGXI-SURFACEB:/proc/sys/kernel$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.4 LTS Release: 14.04 Codename: trusty

and seems I can not set max watchers

wangxi@WANGXI-SURFACEB:~/test$ sudo sysctl -p sudo: unable to resolve host WANGXI-SURFACEB sysctl: cannot stat /proc/sys/fs/inotify/max_user_watches: No such file or directory sysctl: cannot stat /proc/sys/fs/inotify/max_user_watches: No such file or directory sysctl: cannot stat /proc/sys/fs/inotify/max_user_watches: No such file or directory

is there any way I can workaround this ?

wangxiexe avatar Aug 07 '16 10:08 wangxiexe

I am also running the new Ubuntu on Windows and webpack runs once and exits immediately even with the --watch flag. The solution suggested by @artburkart doesn't work in this situation.

chipit24 avatar Aug 12 '16 15:08 chipit24

I am running the new Ubuntu on Windows too and get the same problem with --watch.

I've also ran the webpack-dev-server which works fine but will not watch for changes either.

adammarcwilliams avatar Aug 19 '16 13:08 adammarcwilliams

I've also run into this problem. I think this situation should be considered an error and displayed to the user.

lpil avatar Aug 26 '16 09:08 lpil

Same here, running latest Ubuntu support on windows 10. no watch... no error

gilamran avatar Sep 18 '16 14:09 gilamran

I'm seeing this same behavior on Xubuntu.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.1 LTS
Release:        16.04
Codename:       xenial

$ node -v
v6.7.0

$ npm ls webpack
[email protected] /home/steve/Code/lousyui
└── [email protected] 

Any ideas as to what could be going on here? I don't see any errors/warnings when running webpack and it appears to compile just fine on the first (and only) build.

stevenleeg avatar Oct 23 '16 20:10 stevenleeg

Had the same issue in Ubuntu.

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

jaafit avatar Nov 15 '16 17:11 jaafit

I'm running just in windows 10 cmd. I have the same problem, watch mode just compiles and exits...

orazdow avatar Feb 19 '17 11:02 orazdow

I got the same issue in Debian 8. The inotify watch limit default is too low.

Webpack --watch should give a warning and not just fail silently.

ratiotile avatar Mar 16 '17 15:03 ratiotile

I got the same issue in Windows 10.

                  Asset     Size  Chunks             Chunk Names
5e908b173d38a83d1cb0.js  2.65 kB       0  [emitted]  main
[02:02:15] webpack is watching for changes
qertis@FUCKING-WIN10:/mnt/c/Users/iavto/Documents/Works/polymer-starter-kit$ 

qertis avatar Mar 24 '17 23:03 qertis

Try this workaround:

Add this to your webpack configuration file:

watchOptions: { poll: true },

Works for me on Ubuntu on Windows.

Lahdo posted that here

J4K0B avatar Mar 26 '17 15:03 J4K0B

See the answer by Rich Turner on SO here: http://stackoverflow.com/questions/38922582/running-webpack-with-watch-in-bash-on-ubuntu-on-windows-builds-once-and-exits

Looks like you're running Windows 10 Anniversary Update which didn't yet support INOTIFY file-change event notifications. This capability was added in Insider build 14942 back in Oct 2016:

https://blogs.msdn.microsoft.com/commandline/2016/10/07/wsl-adds-inotify-filesystem-change-notification-support/

Once you upgrade to a recent Insider build, or to Creators Update which will be released this spring, you'll be able to enjoy INOTIFY support which is more efficient than the polling mechanism that your config change enabled.

HTH.

chipit24 avatar Mar 27 '17 13:03 chipit24

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

webpack-bot avatar Sep 25 '17 18:09 webpack-bot

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

webpack-bot avatar Oct 11 '17 10:10 webpack-bot

Experiencing this problem with antergos Linux.

ghost avatar Dec 22 '17 06:12 ghost

@artburkart your suggestion worked for me.

ghost avatar Dec 22 '17 06:12 ghost

Experiencing this on Ubuntu Budgie, but @jaafit your solution worked for me (adding -d flag to the script)

jdavidbakr avatar Feb 20 '18 02:02 jdavidbakr

I am having the same problem

"webpack --watch --progress --hot --mode development "

nicolasxu-bg avatar May 08 '18 18:05 nicolasxu-bg