Home > Mobile >  Nextjs error when first run: Error: Cannot find module 'caniuse-lite/data/features/css-unicode-
Nextjs error when first run: Error: Cannot find module 'caniuse-lite/data/features/css-unicode-

Time:09-13

I got error when start my nextjs project, here's the error

error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[8].use[2]!./styles/globals.css

Error: Cannot find module 'caniuse-lite/data/features/css-unicode-bidi'

and got this require stack

Require stack:

- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/compiled/postcss-preset-env/index.cjs
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/build/webpack/config/index.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/build/webpack-config.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/server/dev/hot-reloader.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/server/dev/next-dev-server.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/server/next.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/server/lib/start-server.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/cli/next-dev.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/lib/commands.js
- /home/ragil/Documents/study/framework/testing/node_modules/next/dist/bin/next

I've tried to install next js with yarn and npm but still i got this problem

CodePudding user response:

downgrading the version of caniuse-lite to below seems to fix the issue

npm i [email protected]

CodePudding user response:

I have tried: "caniuse-lite": "^1.0.30001281" and "caniuse-lite": "^1.0.30001390" but not worked.

Finally I added "caniuse-lite": "1.0.30001393" (without the ˆ prefix) manually to package.json then run npm update and worked.

Reference: https://pullanswer.com/questions/app-fails-to-load-after-running-npm-run-dev-from-fresh-project

CodePudding user response:

The only thing that works for me was to find the file css-unicode-bidi.js from another project.

I paste it in /node_modules/caniuse-lite/data/features/ directory and after this the app works again!

CodePudding user response:

This is an issue with caniuse-lite which was introduced in v1.0.30001394 and fixed in v1.0.30001397. See browserslist/caniuse-lite#100.

To fix it, update to latest version.

npm install [email protected]
  • Related