Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Spinning up the sanity studio gets me this error. The page spins up just fine in local host. Any help fixing this would be greatly appreciatedenter image description here

here is the error in full:

[plugin:vite:css] [postcss] Cannot read properties of undefined (reading 'config')
    at getTailwindConfig (/Users/adamsmith/Desktop/codingprojects/portfolio/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:84:63)
    at /Users/adamsmith/Desktop/codingprojects/portfolio/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:96:92
    at /Users/adamsmith/Desktop/codingprojects/portfolio/node_modules/tailwindcss/lib/processTailwindFeatures.js:46:11
    at plugins (/Users/adamsmith/Desktop/codingprojects/portfolio/node_modules/tailwindcss/lib/index.js:38:63)
    at LazyResult.runOnRoot (/Users/adamsmith/Desktop/codingprojects/portfolio/portfolio-build/node_modules/postcss/lib/lazy-result.js:339:16)
    at LazyResult.runAsync (/Users/adamsmith/Desktop/codingprojects/portfolio/portfolio-build/node_modules/postcss/lib/lazy-result.js:393:26)
    at LazyResult.async (/Users/adamsmith/Desktop/codingprojects/portfolio/portfolio-build/node_modules/postcss/lib/lazy-result.js:221:30)
    at LazyResult.then (/Users/adamsmith/Desktop/codingprojects/portfolio/portfolio-build/node_modules/postcss/lib/lazy-result.js:206:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5

This is the contents of my tailwind.config.js file

@type {import('tailwindcss').Config} 
module.exports = {
  content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [
    require('tailwind-scrollbar')
  ],
}
like image 577
toadlyfe Avatar asked Jan 31 '26 18:01

toadlyfe


2 Answers

I ended up creating a tailwind.config.js file in the sanity folder with the following information. It fixed it.

module.exports = {
  content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',
],
  theme: {
    extend: {},
  },
  plugins: [],
}
like image 184
toadlyfe Avatar answered Feb 03 '26 07:02

toadlyfe


When you create the tailwindcss, Ensure that the content array is not empty, do add the following:

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}',
'./app/**/*.{js,ts,jsx,tsx}',

  ],

  theme: {
    extend: {},
  },
  plugins: [],
}
like image 31
Ewumi Itse Blessing Avatar answered Feb 03 '26 08:02

Ewumi Itse Blessing