Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows, the chokidar watcher does not work well #348

Closed
meteorlxy opened this issue May 6, 2018 · 13 comments · Fixed by #400
Closed

On Windows, the chokidar watcher does not work well #348

meteorlxy opened this issue May 6, 2018 · 13 comments · Fixed by #400

Comments

@meteorlxy
Copy link
Member

meteorlxy commented May 6, 2018

  • OS: Windows 10 x64
  • Node v8.11.1

Related to #346 , not only components, but also markdown files.

The current setting of chokidar only tracks the existed files, but does not track new files on Windows. (Maybe this is an issue of chokidar)

vuepress/lib/dev.js

Lines 30 to 41 in d9b290b

// watch add/remove of files
const pagesWatcher = chokidar.watch([
path.join(sourceDir, '**/*.md'),
path.join(sourceDir, '.vuepress/components/**/*.vue')
], {
ignored: '.vuepress/**/*.md',
ignoreInitial: true
})
pagesWatcher.on('add', update)
pagesWatcher.on('unlink', update)
pagesWatcher.on('addDir', update)
pagesWatcher.on('unlinkDir', update)

In addtion, unlinking a markdown/component file will cause an webapck error first, and then successfully compiled after the prepare finish. Could be enhanced somehow?

@hmatalonga
Copy link
Contributor

Hello @meteorlxy

I am not being able to reproduce this error, I run vuepress dev, add/remove both markdown/component files (also following the mentioned folder tree in #346) and everything works fine for me.

I have tested with vuepress@0.7.0, vuepress@0.8.4 (installed via yarn global) and also directly from the master branch source. I also tried installing via npm i -g

Can you point another example where it causes this error?

@meteorlxy
Copy link
Member Author

meteorlxy commented May 6, 2018

Maybe there is something to do with the OS?

Mine:

  • Windows 10 x64
  • Node v8.11.1

@meteorlxy
Copy link
Member Author

@hmatalonga
I tested on Ubuntu 16.04 with node v8.11.1 and didn't have this problem.

@hmatalonga
Copy link
Contributor

So that's probably a Windows related problem...

I have a Ubuntu-based distro and I am also using node v8.11.1 👍

@meteorlxy meteorlxy changed the title In dev mode, the chokidar watcher does not work well On Windows, the chokidar watcher does not work well May 6, 2018
@meteorlxy
Copy link
Member Author

@hmatalonga What about removing files?

  • After removing a file, an error of webpack occured first.
  • Waiting for the prepare finished, new temp files generated.
  • Another webpack compiling and then successfully compiled displayed.

Maybe this could be enhanced somehow?

@ulivz
Copy link
Member

ulivz commented May 6, 2018

Looks like not a issue of VuePress:

Maybe this is an issue of chokidar.

I think that you can use chokidar to create a simple project, then you can open an issue to chokidar if you found any error.

In addtion, unlinking a markdown/component file will cause an webapck error first,

Same here, create a simple webpack project and test for unlinking and open an issue to webpack if found any error.

@ulivz ulivz closed this as completed May 6, 2018
@meteorlxy
Copy link
Member Author

meteorlxy commented May 6, 2018

@ulivz

The webpack error is not related to webpack.

When unlinking a file, webpack-serve and chokidar will both track the event. If webpack re-compile faster than vuepress's prepare process, an webpack error will occur first. I'll open another issue for that.

And the chokidar is the same as #346 and should be closed too.

@ulivz
Copy link
Member

ulivz commented May 6, 2018

@meteorlxy

This issue is truly not a bug of webpack.

If webpack re-compile faster than vuepress's prepare process ...

No, the webpack re-compile will trigger twice. one is for the source file's add/remove/symlink event, while another one is the generated temp file by prepare.

Closing this bug is due to you were reporting a bug but assumed that it's not a bug of VuePress.

Update

I'll close #346 (I originally thought it also said the middle error, but not = =)

@hmatalonga
Copy link
Contributor

hmatalonga commented May 6, 2018

@meteorlxy

Just to wrap up this,

Indeed after adding a component file and deleting the very same file will lead to the situation that @ulivz described here #351

However, it is possible that on Windows, besides this new issue, will still have problems with chokidar having to restart the dev server (which like you both said it does not seem a bug from vuepress itself)

@luisDanielRoviraContreras
Copy link
Contributor

Then it will not work for my operating system or is there any way? because it really is very tedious to have to restart the server every time I add a new component and in my case I am doing a documentation migrating many components.

@meteorlxy
Copy link
Member Author

#400

It's not an issue of chokidar but ours, as the glob patterns only work with / not \.
On Windows, path module will resolve / to \.

paulmillr/chokidar#714

I misunderstood what he meant and made some meaningless conversation... I just want to express my thanks to the guy but he locked it immediately 😅

@sarjil01
Copy link

sarjil01 commented Jan 26, 2019

Guys Watcher 3 stop working Windows 10 64 bit. It was working half and hour ago now its seems to stop working. Using python latest version Python 3.7.2 Anyone please willing to help me out. i have try several thing still not able to find solulation back in run again watcher 3

OS WINDOWS 10 PRO licence copy

@ulivz
Copy link
Member

ulivz commented Jan 26, 2019

Guys Watcher 3 stop working Windows 10 64 bit. It was working half and hour ago now its seems to stop working.

So what's the real cause of that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants