[vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.

Disclaimer: this is not a fix but rather a quick hack, so that, for instance, you might continue building.

Problem: You’ve just installed TailwindCSS but you get the error below as well as some indication that it might related to the PostCSS config.


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Kenzysc

Disclaimer: this is not a fix but rather a quick hack, so that, for instance, you might continue building.

Problem: You've just installed TailwindCSS but you get the error below as well as some indication that it might related to the PostCSS config.

$ [postcss] Cannot read properties of undefined (reading 'config')
$ [vite] Internal server error: [postcss] Cannot read properties of undefined (reading 'config')

Quick Hack: Copy the content of module.export in the tailwind.config.js file into the value of the tailwindcss property in the postcss.config.js file. Your final result should look like this:

./postcss.config.js

1  module.exports = {
2   plugins: {
3    tailwindcss: {
4       content: [
5         "./index.html",
6         "./src/**/*.{vue,js,ts,jsx,tsx}",
7       ],
8       theme: {
9         extend: {},
10      },
11      plugins: [
12        require('@tailwindcss/forms'),
13      ],
14    },
15    autoprefixer: {},
16  },
17 }

That should do the hack. Cheers.


This content originally appeared on DEV Community 👩‍💻👨‍💻 and was authored by Kenzysc


Print Share Comment Cite Upload Translate Updates
APA

Kenzysc | Sciencx (2022-10-25T14:21:53+00:00) [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.. Retrieved from https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/

MLA
" » [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.." Kenzysc | Sciencx - Tuesday October 25, 2022, https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/
HARVARD
Kenzysc | Sciencx Tuesday October 25, 2022 » [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.., viewed ,<https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/>
VANCOUVER
Kenzysc | Sciencx - » [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/
CHICAGO
" » [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.." Kenzysc | Sciencx - Accessed . https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/
IEEE
" » [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS.." Kenzysc | Sciencx [Online]. Available: https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/. [Accessed: ]
rf:citation
» [vite] Internal server error: Cannot read properties of undefined (reading ‘length’) for Tailwind and PostCSS. | Kenzysc | Sciencx | https://www.scien.cx/2022/10/25/vite-internal-server-error-cannot-read-properties-of-undefined-reading-length-for-tailwind-and-postcss/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.