[vite] Internal server error: Failed to load PostCSS config
Qwik Version
"@builder.io/qwik": "0.0.38", "@builder.io/qwik-city": "0.0.23"
Operating System (or Browser)
Win10
Node Version (if applicable)
16.13.1 (Currently using 64-bit executable)
Which component is affected?
Starters / CLI
Expected Behaviour
Opening the initial page in the browser
Actual Behaviour
Steps to reproduce from the terminal:
-
npm init qwik@latest
-
Select a name to the project
-
Select starter: Qwik city
-
Select server: Cloudflare Pages
-
Select features: Prettier, Tailwindcss
-
Move to the project folder
-
Run npm install
-
Run npm start
Additional Information
Full error output: qwik_terminal_output.txt
I don't know, but it seems related to https://github.com/vitejs/vite/issues/5316
I ran into the same issue on linux. Following the error message I could at least rename the files to postcss.config.cjs (or postcss.config.mjs) and tailwind.config.cjs (or tailwind.config.mjs) as a workaround.
Qwik City is using Vite 3 now, which went all in on ESM. CommonJS files need to be explicitly named as .cjs, like @dacki said. :+1:
had the same error. i removed the postcss.config.js and it works.
Vite 3.1.3
Thanks! also worked for me too!
mee too @chmich
I solved this issue by deleting the node_modules directory, and ran npm i again.
mee too @chmich Vite 3.2.0
Tive esse erro usando o linux ubuntu. Eu removi trocando a extensão .js do arquivo (postcss.config.js) para extensão .cjs ( postcss.config.cjs).
I solved this issue by deleting the node_modules directory, and ran
npm iagain.
This worked instantly
I have the same problem with vuetify 3, none of this above works for me. Any ideas ?
I had the same issue but when I removed postCSS.config file it worked!
For those who are trying to make Tailwind work with Vite, follow below steps:
- Rename
postcss.config.jstopostcss.config.cjs(keeptailwind.config.jsas it is) - Change the content of
postcss.config.cjsas follows:module.exports = ({ env }) => ({ plugins: [ require('tailwindcss')(), require('autoprefixer')() ] })
The above is array format for plugins. Ref: Vite Postcss Config Postcss Load Config
In my case delete type: mode from package.json resolved the issue
vite 4.3.6 instead of cjs use mjs extension.
Add "type": "module" to package.json
What @phukao said also solved another problem for me. Only way to get svelte to run on vite.
``dfdf
@chmich, I'm using Svelte on WSL2. I was getting the same error, but I just run npm install -D tailwindcss postcss autoprefixer and it worked.
had the same error. i removed the
postcss.config.jsand it works. Vite 3.1.3
its worked