我是 node 和 webpack 的新手。我正在尝试设置一个简单的应用程序。我无法让 webpack 成功编译应用程序。我已经为此苦苦挣扎了好几天。我的应用程序位于https://github.com/Weste15/test-app.git。我收到一长串错误。任何帮助将不胜感激。谢谢!
webpack built 7244fa5788b2202d1b0e in 46644ms
? ?wdm?: Hash: 7244fa5788b2202d1b0e
Version: webpack 4.0.1
Time: 46644ms
Built at: 2018-3-2 14:36:59
Asset Size Chunks Chunk Names
bundle.js 11 MiB 0 main
Entrypoint main = bundle.js
[1] ./node_modules/path-browserify/index.js 6.04 KiB {0} [built]
[61] (webpack)/buildin/module.js 519 bytes {0} [built]
[201] ./node_modules/express/index.js 224 bytes {0} [built]
[363] (webpack)/lib/webpack.js 6.97 KiB {0} [built]
[416] ./webpack.config.dev.js 530 bytes {0} [built]
[417] ./routes/users.js 203 bytes {0} [built]
[418] ./routes/index.js 205 bytes {0} [built]
[420] (webpack)-hot-middleware/middleware.js 3.57 KiB {0} [built]
[1090] ./app.js 843 bytes {0} [built]
[1091] (webpack)-hot-middleware/process-update.js 4.23 KiB {0} [built]
[1096] (webpack)-hot-middleware/client-overlay.js 2.16 KiB {0} [built]
[1098] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
[1099] (webpack)-hot-middleware/client.js 7.18 KiB {0} [built]
[1100] (webpack)/hot/dev-server.js 1.66 KiB {0} [built]
[1101] multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js 52 bytes {0} [built]
+ 1087 hidden modules
WARNING in ./node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js
18:11-32 Critical dependency: the request of a dependency is an expression
@ ./node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/minify.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/loader-runner/lib/loadLoader.js
3:2-28 Critical dependency: the request of a dependency is an expression
@ ./node_modules/loader-runner/lib/loadLoader.js
@ ./node_modules/loader-runner/lib/LoaderRunner.js
@ (webpack)/lib/NormalModule.js
@ (webpack)/lib/AutomaticPrefetchPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/use/utils.js
3:34-41 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
@ ./node_modules/use/utils.js
@ ./node_modules/use/index.js
@ ./node_modules/snapdragon/lib/compiler.js
@ ./node_modules/snapdragon/index.js
@ ./node_modules/micromatch/lib/utils.js
@ ./node_modules/micromatch/index.js
@ (webpack)/lib/optimize/SideEffectsFlagPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/worker-farm/lib/child/index.js
49:33-53 Critical dependency: the request of a dependency is an expression
@ ./node_modules/worker-farm/lib/child/index.js
@ ./node_modules/worker-farm/lib/fork.js
@ ./node_modules/worker-farm/lib/farm.js
@ ./node_modules/worker-farm/lib/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/express/lib/view.js
79:29-41 Critical dependency: the request of a dependency is an expression
@ ./node_modules/express/lib/view.js
@ ./node_modules/express/lib/application.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/chokidar/lib/fsevents-handler.js
Module not found: Error: Can't resolve 'fsevents' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\chokidar\lib'
@ ./node_modules/chokidar/lib/fsevents-handler.js 7:17-36
@ ./node_modules/chokidar/index.js
@ ./node_modules/watchpack/lib/DirectoryWatcher.js
@ ./node_modules/watchpack/lib/watcherManager.js
@ ./node_modules/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib/node/NodeEnvironmentPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in (webpack)/lib/debug/ProfilingPlugin.js
Module not found: Error: Can't resolve 'inspector' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib\debug'
@ (webpack)/lib/debug/ProfilingPlugin.js 8:13-33
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in ./node_modules/loader-runner/lib/loadLoader.js
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
@ ./node_modules/loader-runner/lib/LoaderRunner.js 3:2-28 7:17-40
@ (webpack)/lib/NormalModule.js
@ (webpack)/lib/AutomaticPrefetchPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in ./node_modules/worker-farm/lib/fork.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\worker-farm\lib'
@ ./node_modules/worker-farm/lib/fork.js 3:21-45
@ ./node_modules/worker-farm/lib/farm.js
@ ./node_modules/worker-farm/lib/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/cacache/get.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\cacache'
@ ./node_modules/cacache/get.js 5:11-24
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/chokidar/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\chokidar'
@ ./node_modules/chokidar/index.js 3:9-22
@ ./node_modules/watchpack/lib/DirectoryWatcher.js
@ ./node_modules/watchpack/lib/watcherManager.js
@ ./node_modules/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib/node/NodeEnvironmentPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/chokidar/lib/fsevents-handler.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\chokidar\lib'
@ ./node_modules/chokidar/lib/fsevents-handler.js 3:9-22
@ ./node_modules/chokidar/index.js
@ ./node_modules/watchpack/lib/DirectoryWatcher.js
@ ./node_modules/watchpack/lib/watcherManager.js
@ ./node_modules/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib/node/NodeEnvironmentPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/chokidar/lib/nodefs-handler.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\chokidar\lib'
@ ./node_modules/chokidar/lib/nodefs-handler.js 3:9-22
@ ./node_modules/chokidar/index.js
@ ./node_modules/watchpack/lib/DirectoryWatcher.js
@ ./node_modules/watchpack/lib/watcherManager.js
@ ./node_modules/watchpack/lib/watchpack.js
@ (webpack)/lib/node/NodeWatchFileSystem.js
@ (webpack)/lib/node/NodeEnvironmentPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/chownr/chownr.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\chownr'
@ ./node_modules/chownr/chownr.js 4:9-22
@ ./node_modules/cacache/lib/util/fix-owner.js
@ ./node_modules/cacache/lib/util/tmp.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/copy-concurrently/copy.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\copy-concurrently'
@ ./node_modules/copy-concurrently/copy.js 8:13-26
@ ./node_modules/move-concurrently/move.js
@ ./node_modules/cacache/lib/util/move-file.js
@ ./node_modules/cacache/lib/content/write.js
@ ./node_modules/cacache/put.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\destroy'
@ ./node_modules/destroy/index.js 14:17-30
@ ./node_modules/send/index.js
@ ./node_modules/express/lib/response.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/etag/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\etag'
@ ./node_modules/etag/index.js 22:12-25
@ ./node_modules/express/lib/utils.js
@ ./node_modules/express/lib/response.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/express/lib/view.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\express\lib'
@ ./node_modules/express/lib/view.js 18:9-22
@ ./node_modules/express/lib/application.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/fs.realpath/old.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\fs.realpath'
@ ./node_modules/fs.realpath/old.js 24:9-22
@ ./node_modules/fs.realpath/index.js
@ ./node_modules/glob/glob.js
@ ./node_modules/cacache/lib/verify.js
@ ./node_modules/cacache/verify.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/fs.realpath/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\fs.realpath'
@ ./node_modules/fs.realpath/index.js 8:9-22
@ ./node_modules/glob/glob.js
@ ./node_modules/cacache/lib/verify.js
@ ./node_modules/cacache/verify.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/glob/sync.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\glob'
@ ./node_modules/glob/sync.js 4:9-22
@ ./node_modules/glob/glob.js
@ ./node_modules/cacache/lib/verify.js
@ ./node_modules/cacache/verify.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/glob/glob.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\glob'
@ ./node_modules/glob/glob.js 43:9-22
@ ./node_modules/cacache/lib/verify.js
@ ./node_modules/cacache/verify.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/graceful-fs/fs.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\graceful-fs'
@ ./node_modules/graceful-fs/fs.js 3:9-22
@ ./node_modules/graceful-fs/graceful-fs.js
@ ./node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js
@ ./node_modules/enhanced-resolve/lib/node.js
@ (webpack)/lib/ResolverFactory.js
@ (webpack)/lib/Compiler.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/graceful-fs/graceful-fs.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\graceful-fs'
@ ./node_modules/graceful-fs/graceful-fs.js 1:9-22
@ ./node_modules/enhanced-resolve/lib/NodeJsInputFileSystem.js
@ ./node_modules/enhanced-resolve/lib/node.js
@ (webpack)/lib/ResolverFactory.js
@ (webpack)/lib/Compiler.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/loader-runner/lib/LoaderRunner.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\loader-runner\lib'
@ ./node_modules/loader-runner/lib/LoaderRunner.js 5:9-22
@ (webpack)/lib/NormalModule.js
@ (webpack)/lib/AutomaticPrefetchPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/make-dir/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\make-dir'
@ ./node_modules/make-dir/index.js 2:11-24
@ ./node_modules/find-cache-dir/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/mime/mime.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\mime'
@ ./node_modules/mime/mime.js 2:9-22
@ ./node_modules/send/index.js
@ ./node_modules/express/lib/response.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/mkdirp/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\mkdirp'
@ ./node_modules/mkdirp/index.js 2:9-22
@ (webpack)/lib/node/NodeOutputFileSystem.js
@ (webpack)/lib/node/NodeEnvironmentPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/move-concurrently/move.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\move-concurrently'
@ ./node_modules/move-concurrently/move.js 4:13-26
@ ./node_modules/cacache/lib/util/move-file.js
@ ./node_modules/cacache/lib/content/write.js
@ ./node_modules/cacache/put.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/path-exists/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\path-exists'
@ ./node_modules/path-exists/index.js 2:11-24
@ ./node_modules/locate-path/index.js
@ ./node_modules/find-up/index.js
@ ./node_modules/pkg-dir/index.js
@ ./node_modules/find-cache-dir/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/rimraf/rimraf.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\rimraf'
@ ./node_modules/rimraf/rimraf.js 6:9-22
@ ./node_modules/cacache/rm.js
@ ./node_modules/cacache/locales/en.js
@ ./node_modules/cacache/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/uglify/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/index.js
@ ./node_modules/uglifyjs-webpack-plugin/dist/cjs.js
@ (webpack)/lib/WebpackOptionsDefaulter.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/schema-utils/dist/validateOptions.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\schema-utils\dist'
@ ./node_modules/schema-utils/dist/validateOptions.js 11:10-23
@ ./node_modules/schema-utils/dist/index.js
@ ./node_modules/schema-utils/dist/cjs.js
@ (webpack)/lib/BannerPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/send/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\send'
@ ./node_modules/send/index.js 24:9-22
@ ./node_modules/express/lib/response.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node
尝试更仔细地阅读错误日志,它抱怨缺少一些东西。如果你用谷歌搜索它们,你可能会找到答案。
我认为您最有可能使用 Webpack v5,它删除了通常包含的一堆 Polyfill,例如fs和process。在这里阅读更多相关信息,尤其是他们如何在发行说明中删除 NodeJS 填充内容
webpack 5 停止自动填充这些核心模块,并专注于前端兼容的模块。我们的目标是提高与 Node.js 核心模块不可用的 Web 平台的兼容性。
这只是我的预感,从您提供的堆栈跟踪中的错误消息中读取它:
Module not found: Error: Can't resolve 'fs'
Run Code Online (Sandbox Code Playgroud)
您的 webpack 配置针对的是 web (via target)属性,因此fs用于操作文件系统的模块显然在浏览器中不可用。但我看到您的应用程序正在使用在 NodeJS 环境中运行的Express 。所以我认为你应该切换到target并node阅读 Webpack NodeJS 配置。有些文章可以帮助您。
| 归档时间: |
|
| 查看次数: |
2704 次 |
| 最近记录: |