#ReferenceError: module is not defined in ES module scope

13 messages · Page 1 of 1 (latest)

jolly nimbus
#

I have been developing my project happily on my mac, as soon as I move it to my linux VPS, I start getting this stupid error. I am using typescript for my whole project, no js files are in it. Please help, i'm about to rip my hair our as the last time this happened I ended up restarting the project to get rid of the error.

▲ Next.js 14.2.14

✓ Starting...
✓ Ready in 1213ms
○ Compiling /middleware ...
✓ Compiled /middleware in 1104ms (449 modules)
○ Compiling / ...
⨯ ./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/root/DevEnv/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Import trace for requested module:
./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css
./app/globals.css
GET / 500 in 6095ms
⨯ ./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css
ReferenceError: module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/root/DevEnv/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
Import trace for requested module:
./app/globals.css.webpack[javascript/auto]!=!./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[12].use[3]!./app/globals.css
./app/globals.css
GET /next/static/webpack/f1f8feb97646a233.webpack.hot-update.json 500 in 6364ms
GET / 500 in 221ms
⚠ Fast Refresh had to perform a full reload due to a runtime error.
GET / 500 in 6ms
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: ENOENT: no such file or directory, rename '/root/DevEnv/.next/cache/webpack/client-development-fallback/0.pack.gz
' -> '/root/DevEnv/.next/cache/webpack/client-development-fallback/0.pack.gz'
✓ Compiled /favicon.ico in 104ms (338 modules)
GET /favicon.ico 500 in 110ms

tawny templeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

onyx gazelle
#

on your linux server

#

what u could do is -> delete .next/ folder and try again

jolly nimbus
jolly nimbus
onyx gazelle
#

and running npm i

jolly nimbus
#

It was tailwindcss and postcss

#

Their configs are tailwind.config.js and postcss.config.js, simple rename to .cjs fixed it.

onyx gazelle
#

nice!

jolly nimbus
#

Thanks for the suggestions!