SymfonyCasts / tailwind-bundle

Delightful Tailwind Support for Symfony + AssetMapper
https://symfony.com/bundles/TailwindBundle/current/index.html
MIT License
75 stars 16 forks source link

Error on build watch (System limit for number of file watchers reached) #17

Closed bastien70 closed 1 year ago

bastien70 commented 1 year ago

Hey! Thanks for this bundle!

I just want to try it, so I did :

symfony new --webapp test_tailwind_bundle
cd test_tailwind_bundle
composer require symfony/asset-mapper symfony/asset
composer require symfonycasts/tailwind-bundle
php bin/console tailwind:init
php bin/console tailwind:build --watch -v

Juste before the last command I check the base.html.twig, it's okay there is the following lines :

{% block stylesheets %}
            <link rel="stylesheet" href="{{ asset('styles/app.css') }}">
        {% endblock %}

And in the assets/styles/app.css, I've this :

@tailwind base;
@tailwind components;
@tailwind utilities;

body {
    background-color: skyblue;
}

But when running the last command,I've this error :

php bin/console tailwind:build --watch -v

 ! [NOTE] Executing Tailwind (pass -v to see more details).                     

  Command:
    '/home/bastien/Documents/Symfony/test_tailwind_bundle/var/tailwind/tailwindcss-linux-x64' '-i' '/home/bastien/Documents/Symfony/test_tailwind_bundle/assets/styles/app.css' '-o' '/home/bastien/Documents/Symfony/test_tailwind_bundle/var/tailwind/tailwind.built.css' '--watch'

Rebuilding...
node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/home/bastien/Documents/Symfony/test_tailwind_bundle/assets/styles/app.css'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:119:15)
    at setFsWatchListener (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:637:21)
    at async /snapshot/tailwindcss/node_modules/chokidar/index.js:451:21
    at async Promise.all (index 0)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/snapshot/tailwindcss/node_modules/chokidar/index.js:647:10)
    at NodeFsHandler._addToNodeFs (/snapshot/tailwindcss/node_modules/chokidar/lib/nodefs-handler.js:645:18)
    at async /snapshot/tailwindcss/node_modules/chokidar/index.js:451:21
    at async Promise.all (index 0) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/home/bastien/Documents/Symfony/test_tailwind_bundle/assets/styles/app.css',
  filename: '/home/bastien/Documents/Symfony/test_tailwind_bundle/assets/styles/app.css'
}

Seems that this error only pop when launching php bin/console tailwind:build --watch -v. When launching php bin/console tailwind:build, I've this :

! [NOTE] Executing Tailwind (pass -v to see more details).                                                             

  Command:
    '/home/bastien/Documents/Symfony/code-asset-mapper/var/tailwind/tailwindcss-linux-x64' '-i' '/home/bastien/Documents/Symfony/code-asset-mapper/assets/styles/app.css' '-o' '/home/bastien/Documents/Symfony/code-asset-mapper/var/tailwind/tailwind.built.css'

Rebuilding...

Done in 387ms.

Buuuut, there is no file created. According the logs, it sgould create a tailwind.built.css file in var/tailwind, but there is no file

Thank you! :D

weaverryan commented 1 year ago

Hi!

Hmm, these issues might be unrelated - both look very strange. I wonder, in both cases, what happens if you run the commands manually/directly on the command line? For example:

/home/bastien/Documents/Symfony/test_tailwind_bundle/var/tailwind/tailwindcss-linux-x64 -i '/assets/styles/app.css' -o '/var/tailwind/tailwind.built.css' --watch

(run it both with and without the --watch). Are files created? Same error with watch or not? The --watch error is especially odd since you are using a new project, so there should be very few files being watched (the config watches assets/* and templates/* by default, as defined in the tailwind.config.js file).

bastien70 commented 1 year ago

Hello!

Uh, listen, I just tried the same commands again today, without having changed anything, and there, everything is going wonderfully well. I don't know what changed.

Sorry for the wasted time