Closed 8ctopotamus closed 4 years ago
Same error, anyone can fix it?
Hey @yangg, I just keep running hexo s
over and over and eventually it starts up again.
Obviously this is not ideal as the issue still persists. Would be nice if someone could suggest a solution!
@8ctopotamus I'm running hexo on Windows 7 (this PC has a bad performance)
hexo g
has the same problem.
As the theme use hexo-renderer-scss instead of gulp recently, I just removed the dir theme/even/node_modules
, and it works now.
I have same problem under windows bash which I described here https://github.com/Microsoft/BashOnWindows/issues/1126 Is there any workaround or fix?
Same problem on Windows 10 :(
Any update on this? I still have to run hexo s
repeatedly until it finally starts up...
Same here. Tried ulimit -u 3200
without result. Server won't start until the error goes away.
I fixed it by removing my own node_modules
folder from my themes
folder (hexo/themes/[my theme name]/node_modules).
https://github.com/hexojs/hexo/issues/2179
updates? this is really annoying..
This happens because hexo is watching ALL files in sub folders. If you're using grunt, gulp in your theme there are thousands of files and hexo doesn't ignore then.
The only workaround is currently to keep your node_modules outside the hexo root and create a gulp task which copy the files to theme folder.
Agree with you. This was the first thing I did when I saw this error.
Anyway. I couldn't make my theme work without node_modules because it required some files.
Probably there's an issue with the theme itself (tranquilpeak) but shouldn't hexo avoid to check folders like node_modules, bower_components, etc? maybe making this configurable.
I seem to find out how to exclude some directories from the targets of watch(). But I have no Windows environment. (In my Linux (Ubuntu 16.04.1) environment, no error occurs)
Could you please try following patch?
node_modules/hexo/lib/box/index.js
:24$ diff index.js.org index.js
24c24
< ignored: /[\/\\]\./
---
> ignored: /[\/\\](\.[^\/\\]+|node_modules|bower_components)([\/\\]|[\/\\]?$)/
$
node_modules/hexo/lib/box/index.js
:24$ diff -c index.js.org index.js
*** index.js.org 2016-12-23 17:02:13.315065623 +0900
--- index.js 2016-12-23 17:07:11.864219252 +0900
***************
*** 21,26 ****
--- 21,27 ----
EventEmitter.call(this);
this.options = _.assign({
+ ignored: [base + 'node_modules', base + 'bower_components', base + '.git'],
persistent: true
}, options);
$
Please check node_modules/hexo/package.json
to know the version.
Of course, I will make targets configurable when I make a pull request.
Thank you in advance for your cooperation.
Sure!
I have hexo 3.2.0
I applied the .2 patch, but unfortunately, it still not works.
Error: EMFILE: too many open files, open 'C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\readdirp\stream-api.js'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.fs.readFileSync (fs.js:508:33)
at Object.Module._extensions..js (module.js:549:20)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at readdir (C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\readdirp\readdirp.js:56:25)
at FSWatcher.<anonymous> (C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\chokidar\lib\nodefs-handler.js:355:5)
at FSWatcher.NodeFsHandler._handleDir (C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\chokidar\lib\nodefs-handler.js:406:18)
at FSWatcher.<anonymous> (C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\chokidar\lib\nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (C:\git\lucax88x.github.ioold\lucax88x.github.io\node_modules\chokidar\lib\nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:123:15)
Could you taste my new patch?
The patch which I wrote in above comment is not enough.
It makes Hexo turning-off only watch() for node_modules
.
Hexo continuously calls readdir() for all subdirectories in node_modules
.
I make new patch to turn-off readdir()/watch() for specified directories.
Under the patch, Hexo will ignore node_modules
directory and .git
directory and all their subdirectories.
Hexo will NEVER call either readdir() nor watch() for these directories.
And also you can configure which directores are ignored.
You can write ignored_path:
setting in _config.yml
(such as after skip_render:
setting) as follows:
ignored_path:
- node_modules
- .git
- bower_components
- /[\/\\](\.git[^\/\\]*)[\/\\]?$/i
At this time, you can not use glob expressions,
but you can use regular expressions instead.
I'm just getting ahead in myself.
I will reverse them (suit to skip_render:
setting).
My repository is: https://github.com/seaoak/hexo.git
The branch is:
feature/allow-turning-off-reading-and-watching-for-specified-directories
Please checkout the HEAD
of above branch.
p.s. When you execute hexo
, you will see many debugging messages.
You can filter them by grep -v 'seaoak '
.
I'm sorry.
In addition, if you are not familiar with git
command,
please follow the procedure below:
index.js
as node_modules/hexo/lib/box/index.js
default_config.js
as node_modules/hexo/lib/hexo/default_config.js
These links point my commit 743ced890fe29d5bb6be91ba6efa7add1b289ea0
https://github.com/seaoak/hexo/commit/743ced890fe29d5bb6be91ba6efa7add1b289ea0
For example,
$ cd hexo-blog
$ hexo clean
$ (cd node_modules/hexo/lib/box && cp -p index.js index.js.org)
$ curl https://raw.githubusercontent.com/seaoak/hexo/743ced890fe29d5bb6be91ba6efa7add1b289ea0/lib/box/index.js > node_modules/hexo/lib/box/index.js
$ (cd node_modules/hexo/lib/hexo && cp -p default_config.js default_config.js.org)
$ curl https://raw.githubusercontent.com/seaoak/hexo/743ced890fe29d5bb6be91ba6efa7add1b289ea0/lib/hexo/default_config.js > node_modules/hexo/lib/hexo/default_config.js
$ hexo server --debug
And also you can recover these files:
$ hexo clean
$ (cd node_modules/hexo/lib/box && mv index.js.org index.js)
$ (cd node_modules/hexo/lib/hexo && mv default_config.js.org default_config.js)
$ hexo server --debug
I'm ok with git ;)
Anyway, with the 2 files patched, seems to be working, and hexo serves also much much faster this way.
@seaoak I would love to see this solved in official hexo, can you try to make a pull request?
Thanks for your request!
Before I make a pull request, I should make test cases for the patch.
But I found that existing test script for watch()
function was not enough.
So I'm trying to improve it.
https://github.com/hexojs/hexo/blob/master/test/scripts/hexo/hexo.js
I'm sorry for the delay, but I'll make a pull request. :wink:
@seaoak thanks for your active contribution. I have invited you to join Hexo as a collaborator. 😃
@seaoak Sorry for my bad memory, did this issue fix?
Probably solved by #1316, documentation issue still open #2855
Closing as resolved: https://github.com/hexojs/hexo/pull/3797
In the Hexo troubleshooting guide they say to try
...but this does not work on Windows.
Environment Info
Node version
My site
_config.yml
My theme
_config.yml
Plugin version(
npm ls --depth 0
)For BUG