- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是节点和 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_modules/snapdragon/lib/source-maps.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\snapdragon\lib'
@ ./node_modules/snapdragon/lib/source-maps.js 3:9-22
@ ./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
ERROR in ./node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\uglifyjs-webpack-plugin\node_modules\uglify-es\tools'
@ ./node_modules/uglifyjs-webpack-plugin/node_modules/uglify-es/tools/node.js 1:9-22
@ ./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
ERROR in (webpack)/lib/debug/ProfilingPlugin.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib\debug'
@ (webpack)/lib/debug/ProfilingPlugin.js 1:11-24
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in (webpack)/lib/node/NodeMainTemplateAsync.runtime.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib\node'
@ (webpack)/lib/node/NodeMainTemplateAsync.runtime.js 10:2-15 28:3-16
@ (webpack)/lib/node/NodeMainTemplatePlugin.js
@ (webpack)/lib/node/NodeTemplatePlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in (webpack)/lib/node/NodeOutputFileSystem.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib\node'
@ (webpack)/lib/node/NodeOutputFileSystem.js 7:11-24
@ (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/y18n/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\y18n'
@ ./node_modules/y18n/index.js 1:9-22
@ ./node_modules/cacache/lib/util/y.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 (webpack)/lib/NormalModule.js
Module not found: Error: Can't resolve 'module' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib'
@ (webpack)/lib/NormalModule.js 8:21-38
@ (webpack)/lib/AutomaticPrefetchPlugin.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in (webpack)/lib/node/NodeTargetPlugin.js
Module not found: Error: Can't resolve 'module' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\webpack\lib\node'
@ (webpack)/lib/node/NodeTargetPlugin.js 10:1-18
@ (webpack)/lib/WebpackOptionsApply.js
@ (webpack)/lib/webpack.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ERROR in ./node_modules/express/lib/request.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\pol2403\Documents\Node\test-app\node_modules\express\lib'
@ ./node_modules/express/lib/request.js 18:11-25
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./app.js
@ multi webpack/hot/dev-server webpack-hot-middleware/client ./app.js
ℹ 「wdm」: Failed to compile.
var path = require('path');
webpack = require ('webpack');
module.exports = {
devtool: 'inline-source-map',
entry: [
'webpack/hot/dev-server',
'webpack-hot-middleware/client',
path.resolve(__dirname, 'app.js')
],
target: 'web',
output: {
path: '/',
publicPath: 'http://localhost:3000/views/',
filename: 'bundle.js'
},
plugins: [
],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['babel-loader']
},
{
test: /\.ejs$/,
loader: 'ejs-loader'}
]
}
};
var path = require ('path');
var express = require ('express');
var webpack = require ('webpack');
var webpackDevMiddleware = require ('webpack-dev-middleware');
var webpackHotMiddleware = require ('webpack-hot-middleware');
// routes
var index = require('./routes/index');
var users = require('./routes/users');
config = require ('./webpack.config.dev');
app = express();
// setup view engine
app.set('views', path.join(__dirname, 'views'));
app.set ('view engine', 'ejs');
app.use("/", index);
app.use("/users", users);
router = express.Router();
compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, {
publicPath: config.output.publicPath,
stats: {colors: true}
}))
app.use(webpackHotMiddleware(compiler, {
log: console.log
}))
app.listen(3000, () => console.log ('listening on 3000'));
module.exports = app;
var express = require('express');
var router = express.Router();
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'Express' });
});
module.exports = router;
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<!-- <link rel='stylesheet' href='/stylesheets/style.css' /> -->
</head>
<body>
<h1><%= title %></h1>
<p>Welcome to <%= title %></p>
<script src="bundle.js"></script>
</body>
</html>
最佳答案
尝试更仔细地阅读错误日志,它提示缺少一堆东西。如果你用谷歌搜索它们,你可能会找到你的答案。
我认为您最有可能使用 Webpack v5,它丢弃了通常会包含的一堆 polyfill,例如 fs
和 process
. Read more about it here尤其是 how they removed NodeJS polyfills在他们的发行说明中
webpack 5 stops automatically polyfilling these core modules and focus on frontend-compatible modules. Our goal is to improve compatibility with the web platform, where Node.js core modules are not available.
Module not found: Error: Can't resolve 'fs'
您的 webpack 配置针对 web(通过
target
)属性,所以
fs
用于操作文件系统的模块显然在浏览器中不可用。但我看到您的应用程序正在使用
express 它在 NodeJS 环境中运行。所以我认为你应该切换你的
target
至
node
并阅读有关 Webpack NodeJS 配置的信息。有
articles这会帮助你。
关于Webpack 无法编译简单应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49077606/
是否有任何库或框架旨在促进从另一种成熟的编程语言中构建项目? 在 C++、java 等编程语言中指定逻辑、集合和复杂规则非常容易,但在 Makefile 中完成这些事情似乎是一场艰苦的战斗。我还没有深
我有这段代码可以用 clang 编译得很好(即使使用 -Weverything),但是 gcc 会发出错误。 #include #include #include using namespace
我有以下 block 头文件 BKE_mesh.h: /* Connectivity data */ typedef struct IndexNode { struct IndexNode *
我在我的一个项目中遇到了一个奇怪的问题。我的代码库依赖于一个外部库,其中包含一个名为 Dataset 的类. Dataset类私有(private)继承自 std::vector (其中 Sample
当使用 gcc、g++ 或 make 在终端中编译一个小型 C 或 C++ 项目时,我收到以下错误: /tmp/ccG1caGi.o: In function `main': main.c:(.tex
我正在尝试从 CVS 为 Windows 上的 Emacs 23.1.50 编译 CEDET,但在“第 6 步:打开 EDE...”时出现错误:“defvar:作为变量的符号值是无效的:cedet-m
我正在(重新)学习编程,我从 C 开始。我的 IDE(如果我可以这么说)是 Windows7 上的 cygwin(32 位)和 Visual-Studio 2010。我总是编译我用 gcc (cygw
我喜欢在模板类中使用本地类来执行类似“static if”的构造。但是我遇到了 gcc 4.8 不想编译我的代码的问题。但是 4.7 可以。 这个例子: #include #include #in
我有一个项目,必须仅使用 java 1.4 进行编译。但我计划使用mockito 编写一些单元测试。我想要一种在 pom 中指定的方法,以便 src/main/java 使用 jdk 1.4 编译,但
我想了解 PHP 编译过程是如何工作的。 假设我有一个名为funcs.php 的文件并且这个文件有三个函数,如果我include 或require 它,所有的在文件加载期间编译三个函数?或者源代码会被
编译工具链 我们写程序的时候用的都是集成开发环境 (IDE: Integrated Development Environment),集成开发环境可以极大地方便我们程序员编写程序,但是配置起来
当我编写一些 Scala 代码时,在尝试编译代码时收到一条奇怪的错误消息。我将代码分解为一个更简单的代码(从语义的角度来看这完全没有意义,但仍然显示了错误)。 scala> :paste // Ent
我正在编译一个 SCSS 文件,它似乎删除了我的评论。我可以使用什么命令来保留所有评论? >SASS input.scss output.css 我在 SCSS 中看到两种类型的注释。 // Comm
这是我的代码: #include typedef struct { const char *description; float value; int age; } swag
当您编译 grails war 时,我知道 .groovy 代码被编译为字节码类文件,但我不明白容器(例如 tomcat)如何在请求 GSP 时知道如何编译它们。容器了解 GSP 吗?安装在服务器上的
我正在努力将多个文件编译成一个通用程序。我收到一个错误: undefined reference to 'pi' 这是我的代码和 Makefile 的框架。我做错了什么?谢谢! 文件:calcPi.c
我尝试使用 LD_PRELOAD 来 Hook sprintf function ,所以我将打印到缓冲区的结果: #define _GNU_SOURCE #include #include int
我正在寻找最简单的方法来自动将 CoffeeScript 重新编译为 JS。 阅读documentation但仍然很难得到我想要的东西。 我需要它来监视文件夹 src/ 中的任何 *.coffee 文
我想使用定制waveformjs 。我发现this on SO但是,我不知道如何编译/安装波形来开始。我从 GitHub 克隆它并进行了更改,但是我不知道如何将其转换为 .js 文件。 最佳答案 为了
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我是一名优秀的程序员,十分优秀!