tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

TypeError: Cannot read properties of undefined (reading 'insertAfter')

Open in-session opened this issue 3 months ago • 4 comments

Hello everyone,

we sometimes have a problem with the npx tailwindcss build in different instances: image

After some investigation of the whole components css the error comes through as @apply font-bold. As soon as we remove this class the generation of the CSS runs. image

However, we cannot explain how such a problem can occur. Does anyone have an idea how to debug this?

Test on NGINX 1.24.0 with PHP 8.2 NodeJs: v18.17.1 and 20.5.1 and 21.6.1

├── @tailwindcss/[email protected] ├── @tailwindcss/[email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] └── [email protected]

as well: ├── @tailwindcss/[email protected] ├── @tailwindcss/[email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] └── [email protected]

in-session avatar Jan 30 '24 13:01 in-session

Hey — any chance you can provide a reproduction that we can clone? I just set this up in a Vite project with the above CSS and am not encountering an error.

thecrypticace avatar Jan 30 '24 20:01 thecrypticace

Hi, unfortunately not as we are working on a production environment. But I will ask the others. Is there any way of logging the error to find out where the problem could be coming from? We have checked all the logs but can't find an error there.

in-session avatar Jan 31 '24 06:01 in-session

Hi @in-session, can you please share a minimal repro?

mominshaikhdevs avatar Apr 01 '24 07:04 mominshaikhdevs

We were able to identify the problem. It was a problem within a components module:

#maincontent {
        > div.container.font-bold {
            @apply flex-row justify-between items-center;
            @screen lg {
                @apply flex-col items-start;
            }
        }
    }

The problem here was that the selector div.container.font-bold in the module is a tailwind class. As a result, the merge process did not run through. Even if the error message was of course not meaningful.

TypeError: Cannot read properties of undefined (reading 'insertAfter')

in-session avatar Apr 02 '24 05:04 in-session