I just moved my blog to hexo and ran into the “EMFILE: too many open files issue”. The hexo issue page recommends you run ulimit, but that doesn’t work on Windows.
After trying a ton of different things, I finally fixed it by upgrading to the latest version of Node.js v6.9.3.
Solution: Upgrade Node.js to at least v6.9.3
EMFILE: too many open files, open '[path]\node_modules\cheerio\index.js'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502: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 Object.openGraphHelper ([path]\node_modules\hexo\lib\plugins\helper\open_graph.js:27:27)
at Object.wrapper [as open_graph] ([path]\node_modules\lodash\lodash.js:4994:19)
at eval (eval at <anonymous> ([path]\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:49:189)
at eval (eval at <anonymous> ([path]\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:55:1071)
at [path]\node_modules\ejs\lib\ejs.js:255:15
at _compiledSync ([path]\node_modules\hexo\lib\theme\view.js:122:20)
at View.renderSync ([path]\node_modules\hexo\lib\theme\view.js:50:21)
at Object.partial ([path]\node_modules\hexo\lib\plugins\helper\partial.js:42:17)
at Object.wrapper ([path]\node_modules\lodash\lodash.js:4994:19)
at eval (eval at <anonymous> ([path]\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:35)
at eval (eval at <anonymous> ([path]\node_modules\ejs\lib\ejs.js:242:14), <anonymous>:30:2511)
at [path]\node_modules\ejs\lib\ejs.js:255:15
at _compiled ([path]\node_modules\hexo\lib\theme\view.js:127:30)