Compiler is not available

Created on 12 April 2023, about 1 year ago
Updated 11 September 2023, 10 months ago

Hello, I'm trying to get this going, but whatever path I specify (with CLI version, or npm) in the settings.php, the message is the same: CSS compiling is enabled, but compiler is not available.
I am running on windows server 2012, with IIS 8, Drupal 10, and downloaded tailwindcss-windows-x64.exe. I put this executable everywhere... outside and inside web folder, even in themes folder. It has Read and Execute permissions. I also installed via npm, and ended up with some files in the Users/Administrator folder. For this npm install, in settings.php I used as path 'npx taillwindcss', as suggested in this module's page, but I got the same message. I also understand that it's not necessary to create a tailwind.config.js file, but as my instalation didn't work, finally I did a npx tailwind init and got a tailwind.config.js in the Adiministrator folder...
Please guide us here, or provide documentation as what file exactly are we targeting in settings.php for the npm install. Also, for the CLI version, why is it not working? I don't know if this is a bug... or a documentation case.
Please help, thank you.
I used it on a Olivero subtheme.

💬 Support request
Status

Closed: outdated

Version

1.0

Component

Miscellaneous

Created by

🇷🇴Romania CPxiom

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @CPxiom
  • 🇦🇹Austria hudri Austria

    At its core this module runs an executable in the context of the current working directory. Assuming you are using a composer installation of Drupal, and your webserver's document root is set correspondingly, then the current working directory should be the web sub-folder of your Drupal installation.

    So if you download https://github.com/tailwindlabs/tailwindcss/releases/download/v3.3.1/tailwindcss-windows-x64.exe and save it in the web directory, then you can use the filename without any path settings:

    $settings['tailwind_jit_executable'] = 'tailwindcss-windows-x64.exe';

  • 🇷🇴Romania CPxiom

    Hello, thank you for the quick response.
    I followed your suggestions, downloaded the executable again, put it in the web folder, changed settings.php, but I am getting the same message. I checked properties, it has read and execute permissions.
    I also double clicked the exe file, windows warned me it doesn't know the app, I clicked "run anyway", something like a terminal opened, then closed, so I assume the executable is working. If double clicked again, windows doesn't ask me anything, it just runs the program - a terminal opens, then closes.
    It is a composer installation, everything else works fine for now.
    In drupal -> Reports -> Recent log messages, I get messages like this: "The file /tmp/tailwind_jit_XOR7xtefbsHIsRs3foU_bdFf96QS_wXWs9XxO-sjFNo.css was not deleted because it does not exist." Severity: Notice.
    So something is working?... As a file is registered, but not created?

  • 🇦🇹Austria hudri Austria

    Just to be sure, a change in settings.php also needs full cache rebuild (see /admin/config/development/performance in the Drupal admin).

    That message in the log is just a follow-up: For every request, the module tries to create a temporary HTML file as input for TailwindCSS, and a correspoding, compiled CSS file as output from TailwindCSS. When the executable is not called in the first place, the module also can't remove the temporary CSS output file.

    Other than that, the only thing that comes into mind are functions disabled by your PHP installation. Some providers disallow execution of shell commands for security concerns. Visit the page /admin/reports/status/php on your drupal site, and search for disable_functions : the function exec must not be listed there.

  • 🇷🇴Romania CPxiom

    Yes, I cleared cache every time with the Admin toolbar extension. I went to config/development/performance, cleared that way also.
    On the php page, at disable_functions, it writes "no value", both at local and master value.
    This happens on windows server 2012 IIS 8.5, php 8.1.12.

    This is what appears in the php-8.1.12_errors.log found in C:\Windows\Temp

    [13-Apr-2023 13:09:01 UTC] PHP Warning: PHP Startup: Invalid library (appears to be a Zend Extension, try loading using zend_extension=php_opcache.dll from php.ini) in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: Module "curl" is already loaded in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'php_gd2.dll' (tried: C:\Program Files\PHP\php-8.1.12\ext\php_gd2.dll (The specified module could not be found), C:\Program Files\PHP\php-8.1.12\ext\php_php_gd2.dll.dll (The specified module could not be found)) in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: Module "mbstring" is already loaded in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: Module "openssl" is already loaded in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'php_xmlrpc.dll' (tried: C:\Program Files\PHP\php-8.1.12\ext\php_xmlrpc.dll (The specified module could not be found), C:\Program Files\PHP\php-8.1.12\ext\php_php_xmlrpc.dll.dll (The specified module could not be found)) in Unknown on line 0
    [13-Apr-2023 13:23:51 UTC] PHP Warning: PHP Startup: Invalid library (appears to be a Zend Extension, try loading using zend_extension=php_opcache.dll from php.ini) in Unknown on line 0

    This is repeated...
    So it appears that I have some problem with php extensions.

  • 🇷🇴Romania CPxiom

    I added php_gd2.dll ( I had gd) I also added xmlrpc, declared them in php.ini. (The other messages are because those lines appear twice).

    Still it doesn't work, I have the same message. Maybe it has to do with windows permissions, but the exe file has read and execute permissions, and when double clicked, it opens.
    So we are left with no clue :) as why the compiler is unavailable.

  • 🇦🇹Austria hudri Austria

    This would be a minimalistic debug file. Save it as a .php file in your web-folder, e.g. test_tailwind.php, and visit that page.

    <html>
    <body>
    <h1>Testing tailwind executable in plain PHP</h1>
    
    <?php
    
    // turn on all error reporting 
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    
    $cwd = getcwd();
    echo "<p>current dir = {$cwd}</p>";
    
    // run the executable
    exec('tailwindcss', $output, $return_code);
    
    // return code should be 0
    echo "<p>Return code is {$return_code}</p>";
    
    echo "<hr>";
    
    // the output should not be empty.
    foreach ($output as $line) {
        echo "{$line}<br>";
    }
    

    A successful execution should show at least the TailwindCSS version number as output.
    If the return code is anything else than 0, then the problem is somewhere with your local server setup or permissions.
    And delete that file afterwards, nobody should ever be able to read error message from the outside :-)

  • 🇷🇴Romania CPxiom

    It's a long page, but it starts like this:

    Testing tailwind executable in plain PHP
    current dir = C:\inetpub\wwwroot\GetUpTrader\web

    Return code is 0

    /*
    ! tailwindcss v3.3.1 | MIT License | https://tailwindcss.com
    */

    /*
    1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
    2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
    */

    *,
    ::before,
    ::after {
    box-sizing: border-box;
    /* 1 */
    border-width: 0;
    /* 2 */
    border-style: solid;
    /* 2 */
    border-color: #e5e7eb;
    /* 2 */
    }

    ::before,
    ::after {
    --tw-content: '';
    }

    /*
    1. Use a consistent sensible line-height in all browsers.
    2. Prevent adjustments of font size after orientation changes in iOS.
    3. Use a more readable tab size.
    4. Use the user's configured `sans` font-family by default.
    5. Use the user's configured `sans` font-feature-settings by default.
    6. Use the user's configured `sans` font-variation-settings by default.
    */

    And so on.

    So it appears that this debug file is able to execute the exe file.

  • 🇦🇹Austria hudri Austria

    OK, seems you found a bug in my module. Sorry can't help any more right now, I don't have an environment with with Windows Server / IIS available here. I need to organize a test environment before I can dig deeper into this.

    Just a last question: Is the directory listed above the same one as listed in your theme settings?

    e.g. https://www.drupal.org/files/project-images/tailwind_jit_settings_screen... →

  • 🇷🇴Romania CPxiom

    The css files are in /web/themes/olivero_subtheme/css/example.css. This is correctly detected by the module, as it is written with gray.
    I created an empty example.css file, but in my subtheme, I have two css files that override olivero, base.css, and layout.css. But changing the example.css to base.css(for example) for the module at theme settings, it shows the same message.
    Ideally, I would also like to move the tailwind.exe to themes directory, to not be erased by composer when updating. I don't know if it would do that though :).

    How I would like to use this module and tailwind, is that I have the Olivero subtheme, which basically only centers the content and makes the background white. Then in layout builder, if I have something like a customized Teaser, I would like to add some tailwind classes for padding, or to make the title bigger or smaller, with the help of a module like LayoutBuilder styles, or block class, or something similar.
    This is because Olivero doesn't provide some simple utility classes.

    Before, I used the Uikit theme, but on drupal 10 I can't use it, because jQuery is being renounced, and I don't want to install all those jQuery modules. Uikit had utility classes, and it was a well made theme, although barely had maintainance.

    This module is Ideal as it can be used with any theme.

    Over the years Drupal had this (basic in my opinion) layouting problem which now Layout builder solved. Before, there were entire seminars on workaround solutions. Even now, some things are not understood (in my opinion) and there are redundant solutions for some things that now drupal handles natively. For example, Drupal is already "atomic design" simply because it uses fields. These fields are organised with layout builder (now). So it is component oriented, natively. There is also a module mini layouts that allows to have layout within layout, and then we have views to display in a block or a page. (There is even the layout builder for fields - experimental).
    I used the bricks module before, and it is where I understood how Drupal is structured actually.

    So everything is at hand structurally, and having something like tailwind utility classes is finally a dream becoming true.
    Thanks for your help.

  • Status changed to Closed: outdated 10 months ago
  • 🇦🇹Austria hudri Austria
Production build 0.69.0 2024