Hi,
I use a Makefile to build my Jekyll site as well as to initiate jekyll server.
When I do this, I always get this error:
ERROR: directory is already being watched!
Why is this happening?
Below is my Makefile.
(btw. I would highly appreciate any feedback/improvements to my Makefile - especially regarding how images are built - I do that now using a shellscript called “convert_images” that takes source images and generates copies in different resolutions/qualities using imagemagick. However, it is highly inefficient. I would love to know how others approach this - maybe a topic for another thread…)
all : site
README.html:
markdown _meta/README.md > _meta/README.html
checklinks:
htmlproofer --check-html ./_site
assets:
./convert_images
site: README.html assets
jekyll build
server: site assets
jekyll server --port 4005 --watch --livereload --livereload-port 14005 --trace --drafts --future
clean:
$(RM) -rfv _site assets/images/*
$ make server
markdown _meta/README.md > _meta/README.html
jekyll build
Configuration file: /home/....../jekyll-site/_config.yml
Source: /home/....../jekyll-site
Destination: /home/....../jekyll-site/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 11.641 seconds.
Auto-regeneration: disabled. Use --watch to enable.
jekyll server --port 4005 --watch --livereload --livereload-port 14005 --trace --drafts --future
Configuration file: /home/....../jekyll-site/_config.yml
Source: /home/....../jekyll-site
Destination: /home/....../jekyll-site/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 5.671 seconds.
Auto-regeneration: enabled for '/home/....../jekyll-site'
** ERROR: directory is already being watched! **
Directory: /home/....../jekyll-site/assets/bootstrap
is already being watched through: /home/....../jekyll-site/assets/bootstrap-5.2.0-dist
MORE INFO: https://github.com/guard/listen/blob/master/README.md
LiveReload address: http://0.0.0.0:14005
Server address: http://0.0.0.0:4005
Server running... press ctrl-c to stop.
Maximum depth of replacement has been reached. Entry uuid: {xxxxxxxxxxxxxxxxxx}
Well, I do have other jekyll servers running - but they’re running for other servers. Can I only have one jekyll server running per machine?
If this is the case, I really think this should be more clear from the documentation. The man page just says:
s, serve, server
Serve the site locally.
Nothing there about “you may only run one instance per machine”. I also think the actual error about a folder already being watched could be better. It should have a hint about this being the cause if this is the typical cause…
What is the actual directory that is “being watched” (which I am not even sure what means here)? I mean, this sounds like some path being shared across instances (maybe /tmp?) - can’t I somehow configure each instance to use a separate dir?
keep in mind jekylls’ built in web server is really meant for development use - it is not meant to be a production server, just to make it easier to run your site locally to preview it while you are editing it.
Not that it can’t be done (at least for a single site), but it would be better to use an actual web server app for production if that is what you are doing.
In my opinion it is way easier to host via S3 (via amazon amplify) or Netlify - dirt cheap and easy to setup.
Good point. I just checked it. And the hypothesis has been falsified… I get the error even if only one instance of jekyll is running… So it gotta be something else… How do I debug this deeper?
This is what I use it for - development. I work on 6-8 different sites at the moment. These sites are pairwise somewhat similar, so I typically work on at least two simultaneously. Thus, I will typically have two jekyll server instances running on different ports.
However, I just found out that I get the error about dir already being watched even when only one instance is running.
I just found out some more.
I think the error relates to this: I have a symlink in /assets/bootstrap -> bootstrap-5.2.0-dist
This is such that I can refer to the folder bootstrap throughout my code. And when I upgrade bootstrap to a new version, I do not have to update all those references.
It seems jekyll treats /assets/bootstrap, and /assets/bootstrap-5.2.0-dist as two different folders and does not see that one is a symlink to the other…
I think this is related to the problem I am experiencing:
I am not sure what the fix is though. Does this mean that I simply cannot use symlinks?
Please note that, the linked issue is about symlink loops which would obviously cause problems. But I do not have loops. These are regular simple symlinks to a folder within the folder structure being watched.