簡體   English   中英

React: 編譯失敗 // webpack 問題

React: failed to compile // webpack problem

提示:本站收集StackOverFlow近2千萬問答,支持中英文搜索,鼠標放在語句上彈窗顯示對應的參考中文或英文, 本站還提供   中文簡體   英文版本   中英對照 版本,有任何建議請聯系yoyou2525@163.com。

我的項目無法再編譯。 突然來了,不知道為什么。 它似乎與 webpack 有關。 也許我需要將 webpack 5 之前的版本降級,但我不知道如何在 React 中執行此操作。 我設法通過添加 resolve:fallback 將錯誤從 90 減少到 7,但我不知道如何處理其他人。 所以,現在我有這些錯誤:

Failed to compile.

Module not found: Error: Can't resolve 'child_process' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'
WARNING in ./node_modules/jest-worker/build/WorkerPool.js 25:4-29
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build'

WARNING in ./node_modules/jest-worker/build/base/BaseWorkerPool.js 122:19-46
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/jest-worker/build/index.js 71:19-38
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/jest-worker/build/workers/processChild.js 83:15-28
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/jest-worker/build/workers/processChild.js 99:15-28
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/loader-runner/lib/loadLoader.js 20:19-39
Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/terser-webpack-plugin/dist/minify.js 43:118-125
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 519:18-51
Module not found: Error: Can't resolve 'uglify-js/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 596:18-51
Module not found: Error: Can't resolve '@swc/core/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

WARNING in ./node_modules/terser-webpack-plugin/dist/utils.js 678:18-49
Module not found: Error: Can't resolve 'esbuild/package.json' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

WARNING in ./node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/[url]' file: Error: ENOENT: no such file or directory, open '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/[url]'

WARNING in ./node_modules/webpack/lib/debug/ProfilingPlugin.js 29:14-34
Module not found: Error: Can't resolve 'inspector' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib/debug'

WARNING in ./node_modules/webpack/lib/serialization/ObjectMiddleware.js 679:18-34
Critical dependency: the request of a dependency is an expression

ERROR in ./node_modules/jest-worker/build/workers/ChildProcessWorker.js 9:15-39
Module not found: Error: Can't resolve 'child_process' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'

ERROR in ./node_modules/jest-worker/build/workers/NodeThreadsWorker.js 29:15-40
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'

ERROR in ./node_modules/jest-worker/build/workers/messageParent.js 23:8-33
Module not found: Error: Can't resolve 'worker_threads' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/jest-worker/build/workers'

ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 481:6-26
Module not found: Error: Can't resolve 'uglify-js' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 560:14-34
Module not found: Error: Can't resolve '@swc/core' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

ERROR in ./node_modules/terser-webpack-plugin/dist/utils.js 639:18-36
Module not found: Error: Can't resolve 'esbuild' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/terser-webpack-plugin/dist'

ERROR in ./node_modules/webpack/lib/FileSystemInfo.js 11:19-36
Module not found: Error: Can't resolve 'module' in '/Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules/webpack/lib'
Did you mean './module'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules, /Users/yulia/Documents/DEV/JS_REACT/projects/arrosy-moved/node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.

webpack compiled with 7 errors and 13 warnings
問題暫未有回復.您可以查看右邊的相關問題.
2 React擴展關鍵字Webpack無法編譯

我是React的新手,當我編譯下面的代碼時會出錯。 index.js: search_bar.js: 我從終端啟動npm服務器,它在以下鏈接中給出了錯誤: 錯誤圖片 ./src/components/search_bar.js中的錯誤模塊構建失敗:語法錯誤:意外 ...

3 Webpack無法編譯React.js項目

我嘗試使用webpack v2.2.1和web pack-dev-sever v2.4.1構建我的react模板項目。 當我運行“ webpack-dev-server --progress --hot --inline --colors”時,Web Pack報告“編譯失敗”。 我檢查了 ...

4 無法編譯,在Webpack上啟動

我正在嘗試將js,css和html與webpack集成到我的應用程序的前端部分。 我嘗試在application.css文件中使用自定義的CSS,然后將其導入application.js中 。 它正在工作。 現在,我刪除了CSS代碼,並使用yarn安裝了引導程序。 以下是我的pa ...

5 Angular webpack:無法編譯

我正在學習Angular 5的官方教程。 我正在閱讀服務: 章節服務這一章 現在,我在這一章中: 看它運行 瀏覽器刷新后,應用程序應該像以前一樣運行,當您單擊英雄名稱時顯示英雄列表和英雄詳細信息視圖。 我有這個錯誤: 實際上,我只是按照教程,我有這個錯誤 ...

8 Angular 4-Webpack:編譯失敗

當我嘗試npm install一切似乎都可以正常工作,但是隨后ng serve返回錯誤。 我幾乎在嘗試所有事情,但沒有任何效果。 角度版本可能存在問題嗎? 同一項目正在另一台計算機上工作。 有什么建議嗎? ...

10 Webpack無法編譯簡單應用程序

我是Node和Webpack的新手。 我正在嘗試設置一個簡單的應用程序。 我無法使webpack成功編譯該應用程序。 我已經為此苦苦掙扎了好幾天。 我的應用程序位於https://github.com/Weste15/test-app.git 。 我收到一長串錯誤。 任何幫助將不勝感激。 謝謝! ...

2018-03-02 21:21:23 1 2605   webpack
暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2022 STACKOOM.COM