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

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

Closed
1 task done
Actimia opened this issue Mar 26, 2020 · 34 comments
Closed
1 task done
Labels
has PR Has a related PR type: bug Something isn't working

Comments

@Actimia
Copy link

Actimia commented Mar 26, 2020

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

@haoranpb
Copy link
Contributor

May relate to #1283

@ulivz
Copy link
Member

ulivz commented Mar 27, 2020

First met this issue in latest versions.

@meteorlxy
Copy link
Member

@ulivz 诈尸了 😈

@samtgarson
Copy link

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

@alex-outsourci
Copy link

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

@neoPix
Copy link

neoPix commented May 20, 2020

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.

@kum1ko
Copy link

kum1ko commented May 26, 2020

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'

@briancaffey
Copy link

I'm having the same issue.

@dnlsndr
Copy link

dnlsndr commented Jun 16, 2020

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

@andreiTn
Copy link

andreiTn commented Jul 2, 2020

Any solution for this issue?

@PentaTea
Copy link

PentaTea commented Jul 3, 2020

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

@umeshmk
Copy link

umeshmk commented Jul 3, 2020

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

@mlab817
Copy link

mlab817 commented Jul 4, 2020

Same issue here.

@jemerald
Copy link

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

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

Not sure why though

@Benoit-Vasseur
Copy link

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 :/).

@afkoziol
Copy link

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.

@grimalschi
Copy link

Same issue

@jemerald
Copy link

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 😞

spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
spinda added a commit to spinda/vuepress that referenced this issue Aug 11, 2020
Calling emptyDirSync every time createTemp is called - i.e, every time
App.process is called; i.e., every time source files update - throws off
webpack-dev-server, causing it to lose track of the source files and
subdirectories. This leads to a variety of sporadic errors and breaks
auto-refresh of frontmatter and configuration. Fix this by avoiding
emptying temporary directories when we can detect that they were
previously initialized by the same instance of the VuePress process.

Fixes vuejs#1283.
Fixes vuejs#2233.
Fixes vuejs#2254.
Fixes vuejs#2437.
@garcianavalon
Copy link

Reinstalling the latest version of vuepress fixed it for me

@iguit0
Copy link

iguit0 commented Aug 21, 2020

Same issue here.

@oktak
Copy link

oktak commented Sep 9, 2020

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.)

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)

@hsanjuan
Copy link

hsanjuan commented Sep 9, 2020

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.

@afkoziol
Copy link

afkoziol commented Sep 9, 2020

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.

@steersbob
Copy link

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

@afkoziol
Copy link

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

dtinth added a commit to dtinth/vuepress that referenced this issue Sep 16, 2020
To avoid compilation errors caused by removed files
@ProTip
Copy link

ProTip commented Sep 16, 2020

Hitting the same issue very frequently with the Rundeck Docs.

@ZakAnun
Copy link

ZakAnun commented Sep 30, 2020

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.

@steersbob
Copy link

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.

@dtinth
Copy link
Contributor

dtinth commented Oct 20, 2020

I created a PR to fix this: #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?

@billyyyyy3320 billyyyyy3320 added has PR Has a related PR type: bug Something isn't working labels Oct 21, 2020
@theamanjs
Copy link

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 :)

@xolott
Copy link

xolott commented Dec 23, 2020

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

@jd-solanki
Copy link

Still getting the same error.

I can't believe this isn't solved yet.

@meteorlxy
Copy link
Member

Sorry for delay. The fix is available in 1.8.0

@dtinth
Copy link
Contributor

dtinth commented Jan 5, 2021

@meteorlxy Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has PR Has a related PR type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests