webpack mern全栈出错

时间:2018-11-13 19:33:47

标签: webpack mern

我对这门MERN网络应用非常陌生,随后跟随youtube上的一些教程,最终进入了该特定教程,这个家伙使用了webpack,并从package.json脚本运行了命令行,相同的步骤,但就我而言,我收到大量错误和警告,不确定我做错了什么,这是日志

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'webpack' ]
2 info using npm@6.4.1
3 info using node@v8.12.0
4 verbose run-script [ 'prewebpack', 'webpack', 'postwebpack' ]
5 info lifecycle mern-stack-tasks@1.0.0~prewebpack: mern-stack-tasks@1.0.0
6 info lifecycle mern-stack-tasks@1.0.0~webpack: mern-stack-tasks@1.0.0
7 verbose lifecycle mern-stack-tasks@1.0.0~webpack: unsafe-perm in lifecycle true
8 verbose lifecycle mern-stack-tasks@1.0.0~webpack: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Admin\Desktop\MERN-STACK-TASKS\node_modules\.bin;C:\Program Files (x86)\Python37-32\Scripts\;C:\Program Files (x86)\Python37-32\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Users\Admin\AppData\Local\Microsoft\WindowsApps;C:\Users\Admin\AppData\Roaming\npm
9 verbose lifecycle mern-stack-tasks@1.0.0~webpack: CWD: C:\Users\Admin\Desktop\MERN-STACK-TASKS
10 silly lifecycle mern-stack-tasks@1.0.0~webpack: Args: [ '/d /s /c', 'webpack --mode=development' ]
11 silly lifecycle mern-stack-tasks@1.0.0~webpack: Returned: code: 2  signal: null
12 info lifecycle mern-stack-tasks@1.0.0~webpack: Failed to exec webpack script
13 verbose stack Error: mern-stack-tasks@1.0.0 webpack: `webpack --mode=development`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid mern-stack-tasks@1.0.0
15 verbose cwd C:\Users\Admin\Desktop\MERN-STACK-TASKS
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "webpack"
18 verbose node v8.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 2
22 error mern-stack-tasks@1.0.0 webpack: `webpack --mode=development`
22 error Exit status 2
23 error Failed at the mern-stack-tasks@1.0.0 webpack script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

这就是问题

    C:\Users\Admin\Desktop\MERN-STACK-TASKS>npm run webpack

> mern-stack-tasks@1.0.0 webpack C:\Users\Admin\Desktop\MERN-STACK-TASKS
> webpack --mode=development

Hash: e7f652b71ffb968075a8
Version: webpack 4.25.1
Time: 3188ms
Built at: 2018-11-13 16:12:51
  Asset      Size  Chunks             Chunk Names
main.js  2.82 MiB    main  [emitted]  main
Entrypoint main = main.js
[0] ./streams (ignored) 15 bytes {main} [built]
[1] ./extend-node (ignored) 15 bytes {main} [built]
[2] util (ignored) 15 bytes {main} [built]
[3] util (ignored) 15 bytes {main} [built]
[4] http (ignored) 15 bytes {main} [built]
[5] buffer (ignored) 15 bytes {main} [optional] [built]
[6] crypto (ignored) 15 bytes {main} [optional] [built]
[./node_modules/express/lib sync recursive] ./node_modules/express/lib sync 160 bytes {main} [built]
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {main} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
[./src/database.js] 302 bytes {main} [built]
[./src/index.js] 1.14 KiB {main} [built]
[./src/models/task.js] 258 bytes {main} [built]
[./src/routes/task.routes.js] 1.13 KiB {main} [built]
    + 400 hidden modules

WARNING in ./node_modules/express/lib/view.js 81:13-25
Critical dependency: the request of a dependency is an expression
 @ ./node_modules/express/lib/application.js
 @ ./node_modules/express/lib/express.js
 @ ./node_modules/express/index.js
 @ ./src/index.js

ERROR in ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\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
 @ ./src/index.js

ERROR in ./node_modules/etag/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\node_modules\etag'
 @ ./node_modules/etag/index.js 22:12-25
 @ ./node_modules/express/lib/utils.js
 @ ./node_modules/express/lib/application.js
 @ ./node_modules/express/lib/express.js
 @ ./node_modules/express/index.js
 @ ./src/index.js

ERROR in ./node_modules/express/lib/view.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\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
 @ ./src/index.js

ERROR in ./node_modules/mime/mime.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\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
 @ ./src/index.js

ERROR in ./node_modules/send/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\node_modules\send'
 @ ./node_modules/send/index.js 23:9-22
 @ ./node_modules/express/lib/response.js
 @ ./node_modules/express/lib/express.js
 @ ./node_modules/express/index.js
 @ ./src/index.js

ERROR in ./node_modules/express/lib/request.js
Module not found: Error: Can't resolve 'net' in 'C:\Users\Admin\Desktop\MERN-STACK-TASKS\node_modules\express\lib'
 @ ./node_modules/express/lib/request.js 18:11-25
 @ ./node_modules/express/lib/express.js
 @ ./node_modules/express/index.js
 @ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mern-stack-tasks@1.0.0 webpack: `webpack --mode=development`npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mern-stack-tasks@1.0.0 webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:npm ERR!     C:\Users\Admin\AppData\Roaming\npm-cache\_logs\2018-11-13T19_12_51_743Z-debug.log

C:\Users\Admin\Desktop\MERN-STACK-TASKS>npm run dev
> mern-stack-tasks@1.0.0 dev C:\Users\Admin\Desktop\MERN-STACK-TASKS
> nodemon src/index.js

顺便说一句,这件事没有用,我和有类似问题的人一起在github上检查了一下,但看来对我来说不是这种情况

node: {
  fs: 'empty'
}

在此先感谢,并为这篇令人困惑的帖子表示歉意

0 个答案:

没有答案