qwik icon indicating copy to clipboard operation
qwik copied to clipboard

[vite] Internal server error: Failed to load PostCSS config

Open lanzoninicola opened this issue 4 years ago • 46 comments

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:

  1. npm init qwik@latest

  2. Select a name to the project

  3. Select starter: Qwik city

  4. Select server: Cloudflare Pages

  5. Select features: Prettier, Tailwindcss

  6. Move to the project folder

  7. Run npm install

  8. Run npm start

Additional Information

Full error output: qwik_terminal_output.txt

lanzoninicola avatar Jul 23 '22 01:07 lanzoninicola

I don't know, but it seems related to https://github.com/vitejs/vite/issues/5316

lanzoninicola avatar Jul 23 '22 02:07 lanzoninicola

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.

dacki avatar Jul 23 '22 12:07 dacki

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:

nnelgxorz avatar Jul 26 '22 08:07 nnelgxorz

had the same error. i removed the postcss.config.js and it works. Vite 3.1.3

chmich avatar Sep 27 '22 14:09 chmich

Thanks! also worked for me too!

YohannesTz avatar Oct 09 '22 15:10 YohannesTz

mee too @chmich

AGirlHasNoName100 avatar Oct 15 '22 20:10 AGirlHasNoName100

I solved this issue by deleting the node_modules directory, and ran npm i again.

PhytonNet avatar Oct 31 '22 17:10 PhytonNet

mee too @chmich Vite 3.2.0

xuyaofang avatar Nov 02 '22 10:11 xuyaofang

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).

claudioares avatar Nov 23 '22 04:11 claudioares

I solved this issue by deleting the node_modules directory, and ran npm i again.

This worked instantly

Aprotix avatar Nov 30 '22 19:11 Aprotix

I have the same problem with vuetify 3, none of this above works for me. Any ideas ?

georginklv avatar Feb 22 '23 10:02 georginklv

I had the same issue but when I removed postCSS.config file it worked!

Jays0x avatar Apr 20 '23 18:04 Jays0x

For those who are trying to make Tailwind work with Vite, follow below steps:

  • Rename postcss.config.js to postcss.config.cjs (keep tailwind.config.js as it is)
  • Change the content of postcss.config.cjs as follows: module.exports = ({ env }) => ({ plugins: [ require('tailwindcss')(), require('autoprefixer')() ] })

The above is array format for plugins. Ref: Vite Postcss Config Postcss Load Config

vinayakkuradia avatar Apr 22 '23 23:04 vinayakkuradia

In my case delete type: mode from package.json resolved the issue

evn-seyednov avatar Apr 30 '23 11:04 evn-seyednov

vite 4.3.6 instead of cjs use mjs extension.

m-tufail avatar May 16 '23 13:05 m-tufail

Add "type": "module" to package.json

phukao avatar May 27 '23 17:05 phukao

What @phukao said also solved another problem for me. Only way to get svelte to run on vite.

chmich avatar May 27 '23 20:05 chmich

``dfdf

sathishg1990 avatar Jun 23 '23 17:06 sathishg1990

@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.

pedroferreira37 avatar Jun 30 '23 19:06 pedroferreira37

had the same error. i removed the postcss.config.js and it works. Vite 3.1.3

its worked

Ishan-Sandaruwan avatar Jul 03 '23 16:07 Ishan-Sandaruwan