Home > database >  Nextjs got error when first run with yarn and npm
Nextjs got error when first run with yarn and npm

Time:09-12

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

  • Related