啟動 nextjs 專案時出現錯誤,這是錯誤
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'
并得到了這個需要堆疊
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
我嘗試使用 yarn 和 npm 安裝下一個 js,但我仍然遇到了這個問題
uj5u.com熱心網友回復:
將 caniuse-lite 的版本降級到以下似乎可以解決問題
npm i [email protected]
uj5u.com熱心網友回復:
我試過了:"caniuse-lite": "^1.0.30001281"但"caniuse-lite": "^1.0.30001390"沒有奏效。
最后我"caniuse-lite": "1.0.30001393"手動添加(沒有 ^ 前綴)到 package.json 然后運行npm update并作業。
參考:https ://pullanswer.com/questions/app-fails-to-load-after-running-npm-run-dev-from-fresh-project
uj5u.com熱心網友回復:
唯一對我有用的是從另一個專案中找到檔案 css-unicode-bidi.js。
我將它粘貼到 /node_modules/caniuse-lite/data/features/ 目錄中,之后應用程式再次運行!
uj5u.com熱心網友回復:
這是在caniuse-lite中引入v1.0.30001394并修復的問題v1.0.30001397。請參閱browserslist/caniuse-lite#100。
要修復它,請更新到最新版本。
npm install caniuse-lite@1.0.30001397
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/506652.html
標籤:javascript 反应 npm 下一个.js 纱线包装
上一篇:質量問題不是不爆,時候未到
