My next js was working as expected till I tried to do npm run build
and npm run export
, then the error started to appear whenever I tried to do npm run dev
Failed to compile
Next.js (14.2.7)
./src/@menu/styles/styles.module.css
TypeError: root.markClean is not a function
and here is how my ./src/@menu/styles/styles.module.css
looks :
.ul {
list-style-type: none;
padding: 0;
margin: 0;
}
2
Answers
You are running the commands in the wrong order:
npm run build
– generate the build in.next
npm run export
– generate a static exportnpm run dev
– run the dev previewYou can’t run a dev preview on a production build. Instead change the order of commands to:
npm run build
– generate the build in.next
npm run export
– generate a static exportnpm run start
– run the production previewAt current time, this error seems to be related to postcss >= 8.4.42
look into the postcss issue tracker
8.4.43 should have fixed it, but it still persist for me with nextjs 14.2.7.
You can downgrade to postcss 8.4.41 for a temporary fix and wait for a bugfix.