Vuepress: No such file: `node_modules/@vuepress/core/.temp/app-enhancers/global-components-2.js`

Created on 26 Mar 2020  Â·  31Comments  Â·  Source: vuejs/vuepress




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




Bug report

In development mode it sometimes breaks down when incrementally compiling the changes and I get this error in the browser console:

[WDS] Errors while compiling. Reload prevented.

./node_modules/@vuepress/core/.temp/app-enhancers/global-components-2.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: ENOENT: no such file or directory, open '/<path to project>/node_modules/@vuepress/core/.temp/app-enhancers/global-components-2.js'

The build output in the terminal does not report any errors, and will happily recompile further changes, but nothing will happen in the browser.

Steps to reproduce

  • vuepress dev src
  • Make some changes to files, have noticed it both when making changes to content and theme.
  • It works maybe 80-90% of the time, but once the error happens, saving again doesn't fix it and i have to ctrl-c and start the development server again.

I am sorry for not providing a minimal example, but I truly have no clue which part of my code/setup is causing this. I am using a custom theme and VueX, but the issue started appearing before setting up VueX.

What is expected?

A normal incremental compile + hot reload.

What is actually happening?

The error pasted above.

Other relevant information

(I am running this via WSL, which is probably why it doesn't report my browsers)

  • Output of npx vuepress info in my VuePress project:
Environment Info:

  System:
    OS: Linux 4.4 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz
  Binaries:
    Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
    Yarn: 1.19.1 - ~/.yarn/bin/yarn
    npm: 6.14.3 - ~/.nvm/versions/node/v10.15.0/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vuepress/core:  1.4.0
    @vuepress/theme-default:  1.4.0
    vuepress: ^1.3.0 => 1.4.0
  npmGlobalPackages:
    vuepress: Not Found

Other than this issue, I really really like using VuePress so far, keep up the great work!

has PR bug

Most helpful comment

I'm having the same issue.

All 31 comments

May relate to #1283

First met this issue in latest versions.

@ulivz 诈尸了 😈

The initial build works fine for me, but I get this as soon as I make any incremental change to the theme. Errors in the browser:

image

Environment Info:

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (2) x64 Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
  Binaries:
    Node: 12.10.0 - /tmp/yarn--1586344987626-0.24074515643434302/node
    Yarn: 1.21.1 - /tmp/yarn--1586344987626-0.24074515643434302/yarn
    npm: 6.10.3 - ~/.asdf/installs/nodejs/12.10.0/bin/npm
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: Not Found
  npmPackages:
    @vuepress/core:  1.4.0
    @vuepress/theme-default:  1.4.0
    vuepress: ^1.4.0 => 1.4.0
  npmGlobalPackages:
    vuepress: Not Found

@Actimia , did you find any workaround? I have same issue, tested on versions > 1.0
Only versions < 1.0 works, currently choose 0.14.11 which works fine to me.

Did anybody found a solution to this ? I'm having the very same issue.

@alex-outsourci It also works well with pre v1.0.0 versions.

I encountered the same problem.
Everything ran smoothly the first time, and when I changed a certain file to trigger a hot load, the refresh page ran into the same problem as @samtgarson
The error has to do with not being able to find the file in the temp directory, but the file actually exists.

Uncaught Error: Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: ENOENT: no such file or directory, open 'C:\Users\Txo\vue-press\tx\internal\routes.js'

I'm having the same issue.

Having the same issue, it's a bit annoying when hot reloading stops working

Any solution for this issue?

大佬们解决了没,我最近两周出的这个问题

Same issue here. Tried upgrading to node 14.5.0 still it persists.

Same issue here.

I had the same issue, mitigated by specifying a different temp folder.

"dev": "vuepress dev docs --temp .temp",

Not sure why though

I had the same issue, mitigated by specifying a different temp folder.

"dev": "vuepress dev docs --temp .temp",

Not sure why though

Tried to pass temp arg but it is not working for me, I still have this error :/.
I am in a mono repo and launch vuepress with vuepress dev ..
I personnaly have this error systematically after a save on a file (of extraWatchFiles because otherwise the save is not seen by vuepress :/).

Specifying the temp dir also did not fix it for me.

I started vuepress dev in debug mode and the createTemp.js utility is called when I make changes. This utility also happens to empty the contents if it exists. The contents are the repopulated but perhaps not before webpack needs it to rebuild? Could be a timing problem.

If I comment out line 23 in ./node_modules/@vuepress/core/lib/node/createTemp.js
// fs.emptyDirSync(tempPath)
Then the "[WDS] Errors while compiling. Reload prevented." does not appear and the page reloads with my changes.

I'm sure there are some repercussions of this but maybe it can point someone in the right direction for a real fix.

Same issue

Yeah, the --temp option only helped a little, I'm currently using this work around instead

"start": "nodemon --ext md,vue,js --watch .vuepress --watch . --exec vuepress dev doc"

have to manually refresh the browser to see the changes, but at least it would not error 😞

Reinstalling the latest version of vuepress fixed it for me

Same issue here.

Same issue here ("vuepress": "1.5.4"). I tried to trace for '/path_to_project/node_modules/@vuepress/core/.temp/app-enhancers/global-components-2.js', which seems related to Temp files.

I tried to comment out fs.emptyDirSync(tempPath) here (I directly modified the js in node_modules for testing purpose.)
https://github.com/vuejs/vuepress/blob/e5d8ed4655b42e975a1d72286bc859257b3d2eb9/packages/%40vuepress/core/lib/node/createTemp.js#L23

It seems no more errors triggered. I suspect that there could be reading files that listed in the cached files (those json files in /path_to_project/node_modules/@vuepress/core/node_modules/.cache/vuepress/*.json), while the Temp folder is emptied before writing the new Temp files.

I inserted console.trace(); after fs.emptyDirSync(tempPath). It prints the trace below. I looked into /<path_to_project>/node_modules/@vuepress/core/lib/node/App.js:475, seems it is tracking the file changes, then do the process, including the createTemp process, and other reloading the plugins... etc.

I cannot go further. Perhaps I need to be more familiar with the mechanism of VuePress first.

Trace
    at createTemp (/path_to_project/node_modules/@vuepress/core/lib/node/createTemp.js:25:13)
    at App.resolveConfigAndInitialize (/path_to_project/node_modules/@vuepress/core/lib/node/App.js:79:37)
    at App.process (/path_to_project/node_modules/@vuepress/core/lib/node/App.js:103:16)
    at DevProcess.<anonymous> (/path_to_project/node_modules/@vuepress/core/lib/node/App.js:475:20)
    at DevProcess.emit (events.js:315:20)
    at DevProcess.handleUpdate (/path_to_project/node_modules/@vuepress/core/lib/node/dev/index.js:59:10)
    at FSWatcher.<anonymous> (/path_to_project/node_modules/@vuepress/core/lib/node/dev/index.js:105:52)
    at FSWatcher.emit (events.js:315:20)
    at FSWatcher.<anonymous> (/path_to_project/node_modules/chokidar/index.js:199:15)
    at FSWatcher._emit (/path_to_project/node_modules/chokidar/index.js:241:5)
    at FSWatcher.<anonymous> (/path_to_project/node_modules/chokidar/lib/nodefs-handler.js:274:18)
    at FSReqCallback.oncomplete (fs.js:169:5)

I tried to comment out fs.emptyDirSync(tempPath) here (I directly modified the js in node_modules for testing purpose.)

This seems to solve the issue for me, otherwise reload/update fails 95% of the time.

Specifying the temp dir also did not fix it for me.

I started vuepress dev in debug mode and the createTemp.js utility is called when I make changes. This utility also happens to empty the contents if it exists. The contents are the repopulated but perhaps not before webpack needs it to rebuild? Could be a timing problem.

If I comment out line 23 in ./node_modules/@vuepress/core/lib/node/createTemp.js
// fs.emptyDirSync(tempPath)
Then the "[WDS] Errors while compiling. Reload prevented." does not appear and the page reloads with my changes.

I'm sure there are some repercussions of this but maybe it can point someone in the right direction for a real fix.

Just an update (since it's the same work around mentioned recently) that this has been working for my project for close to two months now, I have yet to run into a situation where it doesn't work. We have ~100 pages so it's a decent sized doc site.

I tried to reproduce the problem with a simple example repository that could be referenced here but I couldn't. I tried making a few hundred pages of generic info and couldn't get it to fail. Unfortunately, I can't share our repos where it has confirmed to fail. Maybe it's got something to do with the randomness of the sidebar/inter page linking that a real site has vs one that is generated programatically.

@afkoziol Our documentation repo is public, and fails quite consistently for me. Can you reproduce it there?

@afkoziol Our documentation repo is public, and fails quite consistently for me. Can you reproduce it there?

Yup! I was able to repro it very easily. Ran the dev server, renamed one of the second level headers and it failed.

Hitting the same issue very frequently with the Rundeck Docs.

I met this problem and could not hot reload and I run these:

yarn cache clean
yarn upgrade
yarn run dev

and then works for me.

If I comment out line 23 in ./node_modules/@vuepress/core/lib/node/createTemp.js
// fs.emptyDirSync(tempPath)

This workaround worked for me. The automated version:

sed -i \
  's=^\([[:space:]]*\)fs\.emptyDirSync(tempPath)$=\1// fs\.emptyDirSync(tempPath)=g' \
  node_modules/@vuepress/core/lib/node/createTemp.js

It should also work on MacOS, but haven't tested.

I created a PR to fix this: https://github.com/vuejs/vuepress/pull/2612 but it has not been reviewed or merged for over a month. 😢

@bencodezen @billyyyyy3320 I apologize for the unsolicited mention, but can I get a review for the aforementioned PR?

I tried deleting node_modules and package-lock.json and it solved my problem. I don't know whether it's recommended or not. But it just solved :)

Is there any ETA on when this will be released? Or there is some release schedule?

Was this page helpful?
0 / 5 - 0 ratings