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

Hot reload not working #2392

Closed
1 task done
reiwa opened this issue May 18, 2020 · 62 comments
Closed
1 task done

Hot reload not working #2392

reiwa opened this issue May 18, 2020 · 62 comments
Assignees
Labels
priority: high High priority issue type: bug Something isn't working

Comments

@reiwa
Copy link

reiwa commented May 18, 2020

  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

$ yarn add vuepress --dev
$ mkdir docs
$ youch docs/index.md
$ yarn vuepress dev docs

success [08:52:12] Build 1d01b9 finished in 172 ms! ( http://localhost:8080/ )

What is expected?

Vuepress CLI detects file changes and rebuilds.

What is actually happening?

Vuepress CLI doesn't detect file changes. I have to run vuepress dev docs again to build codes.

Other relevant information

  • Output of npx vuepress info in my VuePress project:
% npx vuepress info

Environment Info:

  System:
    OS: macOS 10.15.4
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 14.2.0 - ~/.nodebrew/current/bin/node
    Yarn: 1.22.4 - ~/.nodebrew/current/bin/yarn
    npm: 6.14.4 - ~/.nodebrew/current/bin/npm
  Browsers:
    Chrome: Not Found
    Edge: Not Found
    Firefox: Not Found
    Safari: Not Found
  npmPackages:
    @vuepress/core:  1.5.0 
    @vuepress/theme-default:  1.5.0 
    vuepress: ^1.5.0 => 1.5.0 
  npmGlobalPackages:
    vuepress: Not Found
@reiwa

This comment has been minimized.

@iDerekLi
Copy link

I have the same situation. After testing node v10.15.3 hot not working. Node v12.14.0 hot working

@xyyxlq
Copy link

xyyxlq commented May 19, 2020

I have the same problem too.
When I change the content of .md files, the hot reload don't work, even the Vuepress CLI doesn't detect file changes.
I have tried with node v10.15.0 and node v12.16.3,but the hot still don't works。

@Karlbovski
Copy link

Same here, not sure if it´s related to the latest Node v12.16.3 upgrade I've made, since in some projects (with similar packages structure and same pkgs versions) hot reloading still works. Very confused atm...

@pepsifan
Copy link

I had the same problems a few days ago. I use a workaround to restart the server on file change. See here.

@Yaakov-Belch
Copy link

I tried vuepress 1.4.1 with node 12.16.3 with a new install now -- and it vuepress does not recognize document changes (hot reload does not work). It looks like a regression in one of the dependencies --- so by loading the newer version of the dependency, the feature breaks. I don't know what package is broken.

@Yaakov-Belch
Copy link

It seems that in its dependency chain, vuepress uses outdated packages for Chokidar and fsevents that are responsible for watching file changes.

Here is my current install log:

warning vuepress > @vuepress/core > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning vuepress > @vuepress/core > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning vuepress > @vuepress/core > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning vuepress > @vuepress/theme-default > docsearch.js > hogan.js > mkdirp@0.3.0: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
warning vuepress > @vuepress/theme-default > docsearch.js > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning vuepress > @vuepress/core > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning vuepress > @vuepress/theme-default > stylus > css-parse > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning vuepress > @vuepress/core > chokidar > braces > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning vuepress > @vuepress/core > chokidar > braces > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

As far as I see, the relevant messages are:

  • vuepress/core and webpack-dev-server depend on chokidar@2.1.8 with the warning: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
  • chokidar depends on fsevents@1.2.13 or fsevents@2.1.3. Both of these package issue the warning The platform "linux" is incompatible with this module. Quite possibly, chokidar uses other modules on the linux platform.

@pepsifan
Copy link

As I can see, chokidar is only used for watching files which are added or deleted (see source) and for changes in the config file (see source). I rather think it's a problem with a loader for the webpack server which can't detect changes of .md and .vue files. The loaders are registered in createBaseConfig.js.

@yangtao2o
Copy link

I have the same problems now.
Currently, the best solution that does not affect normal use is to directly replace the previous whole node_modules, then without npm install, and just npm run dev the project.
I used the vuepress 1.41 package I downloaded earlier, now node v12.16.3, hot reload working

Yes, this way is currently the most effective,and wait for the latest version to deal with this problem.

I used the vuepress v1.40, and node v14.2.0, hot reload working.

And use nodemon to automate the restart on every file change. Thanks @pepsifan .

yarn add -D nodemon
{
  "scripts": {
    "dev": "nodemon --ext md,vue --watch .vuepress --watch . --exec vuepress dev docs",
  }
}

@fmonper1
Copy link

fmonper1 commented May 23, 2020

Vuepress v1.4.0, hot reloading not working with node v14.3.0. Using nodemon isnt working either

Edit: For some reason updating the config.js does trigger the hot reload, but nothing happens with the other files

@a616781689
Copy link

me too

@qyingkou
Copy link

follow bug fixes...

@faroit
Copy link

faroit commented May 24, 2020

is there any working workaround (I would be willing to downgrade to older versions)... when was this broken?

@kurotanshi
Copy link

I have the same problem :(

@bencodezen bencodezen added the type: bug Something isn't working label May 24, 2020
@bencodezen
Copy link
Member

Thanks for filing the issue @reiwa! Going to take a look into this as a high priority. Appreciate it!

@bencodezen bencodezen added the priority: high High priority issue label May 24, 2020
@changhighly
Copy link

I have the same problems now.
Currently, the best solution that does not affect normal use is to directly replace the previous whole node_modules, then without npm install, and just npm run dev the project.
I used the vuepress 1.41 package I downloaded earlier, now node v12.16.3, hot reload working

Yes, this way is currently the most effective,and wait for the latest version to deal with this problem.

I used the vuepress v1.40, and node v14.2.0, hot reload working.

And use nodemon to automate the restart on every file change. Thanks @pepsifan .

yarn add -D nodemon
{
  "scripts": {
    "dev": "nodemon --ext md,vue --watch .vuepress --watch . --exec vuepress dev docs",
  }
}

Although it works, I have to refresh my browser for it to work

@SCWR
Copy link

SCWR commented May 25, 2020

"watchpack": "1.6.1"

npm i -D watchpack@1.6.1

I noticed that the webpack hot update plugin watchpack is now 1.7.2
I compared the previous project and found it was 1.6.1
So I tried to install this version
It's ready for hot update

npx vuepress info

Environment Info:

  System:
    OS: Windows 10 10.0.18363
    CPU: (8) x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
  Binaries:
    Node: 10.15.2 - D:\nodejs\version\node.EXE
    Yarn: 1.22.4 - D:\YarnCache\bin\yarn.CMD
    npm: 6.14.5 - D:\YarnCache\bin\npm.CMD
  Browsers:
    Edge: 44.18362.449.0
  npmPackages:
    @vuepress/core:  1.5.0
    @vuepress/theme-default:  1.5.0
    vuepress: ^1.5.0 => 1.5.0
  npmGlobalPackages:
    vuepress: Not Found

yarn installs "watchpack": "^1.6.1" separately in webpack
This automatically correlates to 1.7.2
So it only works in npm mode
yarn solution is answered below

In a project created by @vue/cli 4.3.1, the watchpack is 1.7.2, but it can still trigger hot updates
Confused!

@xyyxlq
Copy link

xyyxlq commented May 25, 2020

@SCWR Thanks, it works.

@ansky-pro
Copy link

Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1
Added resolutions section to package.json and ran yarn install

  "resolutions": {
    "watchpack": "1.6.1"
  }

Hope this helps to anyone struggling with the same problem

@SCWR
Copy link

SCWR commented May 26, 2020

Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1
Added resolutions section to package.json and ran yarn install

  "resolutions": {
    "watchpack": "1.6.1"
  }

Hope this helps to anyone struggling with the same problem

I acquired new knowledge @ansky-pro Thanks

@Loyz07
Copy link

Loyz07 commented May 26, 2020

Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1
Added resolutions section to package.json and ran yarn install

  "resolutions": {
    "watchpack": "1.6.1"
  }

Hope this helps to anyone struggling with the same problem

I acquired new knowledge @ansky-pro Thanks

Hello,

For those who still want to use npm (resolutions only works with yarn by default). You can use this package : https://github.com/rogeriochaves/npm-force-resolutions.

@pepsifan
Copy link

I think, a good solution would be to commit the package-lock.json into the repo. So the users only have to npm ci. This will ensure that the deps are exactly the same like the ones defined in package-lock.json.

soasme added a commit to enqueuezero/site that referenced this issue May 27, 2020
@morosefrog
Copy link

morosefrog commented May 28, 2020

Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1
Added resolutions section to package.json and ran yarn install

  "resolutions": {
    "watchpack": "1.6.1"
  }

Hope this helps to anyone struggling with the same problem

Good job , Thanks

dennisreimann added a commit to dennisreimann/btcpayserver-doc that referenced this issue May 28, 2020
@pikax
Copy link
Member

pikax commented Jun 10, 2020

@tecnoloco can you provide a repo where I can reproduce that, please?

EDIT: Seen your issue

@thominal
Copy link

Hi,

@bencodezen @pilax

I try to recreate a new project from scratch: I have the same observations as @tecnoloco :

  • No issue with .md files, hot reload works well
  • However, I need to restart manually my server to see config.js changes.

My config.js file is as simple as:

module.exports = { title: 'Hello Wolrd', description: 'Just playing around' }

Thanks

@surjithctly
Copy link

I tried everything in the above. But its not working for me too in windows.

The terminal log updates and says build is finished. But its not updating in server. Even refresh not working. had to terminate the job and run vuepress dev again to see the changes.

Please provide me a fix.

@bencodezen
Copy link
Member

Hi @surjithctly! We're tracking the bug regarding the config and frontmatter here: #2437

Are you still having issues with the markdown files not reloading?

@surjithctly
Copy link

@bencodezen Yes. Markdown works fine. The data inside --- 3 lines do not work.

@bencodezen
Copy link
Member

@surjithctly Got it. I would definitely add your comments and threads to #2437 then. Thank you!

@SimZhou
Copy link

SimZhou commented Jun 30, 2020

webpack downgraded to 1.6.1, but still not working.

  • √ Changing content in .md file works
  • × Changing front matter in .md file NOT works
  • × Changing config.js NOT works

@aceven24
Copy link

Same here, frontmatter in .md does not work.
I'm using a local custom theme
Also Typescript

Here is my info

Environment Info:

System:
OS: Windows 10 10.0.18363
CPU: (8) x64 Intel(R) Core(TM) i5-1035G7 CPU @ 1.20GHz
Binaries:
Node: 12.13.1 - ~\AppData\Local\Temp\yarn--1593533765469-0.49432315341001365\node.CMD
Yarn: 1.21.1 - ~\AppData\Local\Temp\yarn--1593533765469-0.49432315341001365\yarn.CMD
npm: 6.12.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 44.18362.449.0
npmPackages:
@vuepress/core: 1.5.2
@vuepress/theme-default: 1.5.2
vuepress: ^1.5.2 => 1.5.2
npmGlobalPackages:
vuepress: Not Found

@SimZhou
Copy link

SimZhou commented Jun 30, 2020

Try npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .temp instead. See if it works for you.

If yes you could write this into package.json: "dev": "vuepress dev docs --temp .temp"

@aceven24
Copy link

Try npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .temp instead. See if it works for you.

If yes you could write this into package.json: "dev": "vuepress dev docs --temp .temp"

Tried that, even blew away my node_modules an yarn lock and reinstalled, same issue.. :-(

@sdwru
Copy link

sdwru commented Jul 17, 2020

Any updates. I'm having the same problem. Using yarn vuepress dev docs --temp .temp doesn't work either.

@surjithctly
Copy link

@sdwru Check this open issue from 2019. Still not fixed #1283

@SimZhou
Copy link

SimZhou commented Jul 17, 2020

Evan is now making a new tool to solve it...
check vuejs/vitepress#motivation

@aceven24
Copy link

aceven24 commented Jul 18, 2020 via email

@surjithctly
Copy link

Evan is now making a new tool to solve it...
check vuejs/vitepress#motivation

That’s an awesome news. Thanks for letting me know.

larionov pushed a commit to larionov/vuepress that referenced this issue Aug 19, 2020
* fix: watch for chokidar v3

* chore: remove comments
dennisreimann added a commit to dennisreimann/hey-bitcoin.de that referenced this issue Nov 6, 2020
@sundayz
Copy link

sundayz commented Jan 4, 2021

Try npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .temp instead. See if it works for you.

If yes you could write this into package.json: "dev": "vuepress dev docs --temp .temp"

This worked for me using 1.7.1 and npm, Windows 10. I don't know why or what it does.

@boris-savic
Copy link

Try npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .temp instead. See if it works for you.
If yes you could write this into package.json: "dev": "vuepress dev docs --temp .temp"

This worked for me using 1.7.1 and npm, Windows 10. I don't know why or what it does.

This works for me as well for config.js changes but not for index.md changes.

Also running on Windows 10 with Node 14.15.0.

@meteorlxy
Copy link
Member

If you are not strictly using vue 2, try vuepress 2 or vitepress.

@SimZhou
Copy link

SimZhou commented Jan 10, 2021

If you are not strictly using vue 2, try vuepress 2 or vitepress.

what's the difference between these two btw? Which one is official, or both?@meteorlxy

@meteorlxy
Copy link
Member

Both are vue.js team projects

@aku752
Copy link

aku752 commented Apr 13, 2021

Prueba npm vuepress dev docs --temp .temp/ en su yarn vuepress dev docs --temp .templugar. Mira si te funciona.

Si es así, puede escribir esto en package.json: "dev": "vuepress dev docs --temp .temp"

Try npm vuepress dev docs --temp .temp/yarn vuepress dev docs --temp .temp instead. See if it works for you.

If yes you could write this into package.json: "dev": "vuepress dev docs --temp .temp"

Gracias me funciono lo del .md y config. :)

@euberdeveloper
Copy link

Thanks to @SCWR I got it working by downgrading watchpack to 1.6.1 Added resolutions section to package.json and ran yarn install

  "resolutions": {
    "watchpack": "1.6.1"
  }

Hope this helps to anyone struggling with the same problem

For whom does not use yarn but npm, "ovverides" should be the analogue

@bbsimonbb
Copy link

I added the resolutions section to package.json. Still broken. Ouch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high High priority issue type: bug Something isn't working
Projects
None yet