hexojs / hexo-server

Server module for Hexo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ignore themes Node_modules

a632079 opened this issue · comments

While My Theme use babel & Webpack, run hexo server. It will Print (Like):

INFO  Deleted database.
INFO  Start processing
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: watch /home/a632079/Desktop/a632079/themes/aero-dual/node_modules/lodash/fp/F.js ENOSPC
    at _errnoException (util.js:1003:13)
    at FSWatcher.start (fs.js:1405:19)
    at Object.fs.watch (fs.js:1431:11)
    at createFsWatchInstance (/home/a632079/Desktop/a632079/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/home/a632079/Desktop/a632079/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/a632079/Desktop/a632079/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleFile (/home/a632079/Desktop/a632079/node_modules/chokidar/lib/nodefs-handler.js:255:21)
    at FSWatcher.<anonymous> (/home/a632079/Desktop/a632079/node_modules/chokidar/lib/nodefs-handler.js:473:21)
    at FSReqWrap.oncomplete (fs.js:167:5)

To solve it,
I need to REMOVE node_modules dir.
Could you give a parameter to ignore this dir ?

You might be able to try using the ignore: config parameter added in hexojs/hexo#2631 from issue hexojs/hexo#2632. This adds a global ignore parameter to exclude folders from watching/processing, but I could only get it to work from the projects config, not the theme config.

Adding the following code will stop it from watching/processing these files during generation or serving.

ignore: ['**/themes/**/node_modules/**', '**/themes/**/node_modules', '**/themes/**/.git', '**/themes/**/.git/**']

node_modules/ and .git/ in themes/ folder are now always ignored in Hexo 4.1.1+.
hexojs/hexo#3918