我在使用node js安装模块的时候,提示已经安装成功了,但是在使用webpack打包的时候又报错了。
报错内容:
PS C:\Users\Administrator\Desktop\Node_Word> npx webpack
assets by status 1.33 MiB [cached] 1 asset
orphan modules 1.67 MiB [orphan] 298 modules
runtime modules 1.02 KiB 6 modules
modules by path ./node_modules/ 3.95 MiB
javascript modules 3.86 MiB
cacheable modules 3.86 MiB 313 modules
optional modules 320 bytes [optional] 2 modules
json modules 89.9 KiB
./node_modules/tedious/package.json 3.23 KiB [built] [code generated]
./node_modules/iconv-lite/encodings/tables/shiftjis.json 8.78 KiB [built] [code generated]
+ 7 modules
./js/server.js 9.67 KiB [built] [code generated]
stream (ignored) 15 bytes [optional] [built] [code generated]
./util.inspect (ignored) 15 bytes [built] [code generated]
util (ignored) 15 bytes [built] [code generated]
util (ignored) 15 bytes [built] [code generated]
WARNING in ./node_modules/defaultable/defaultable.js 49:13-31
Critical dependency: the request of a dependency is an expression
@ ./node_modules/hbo-dnsd/server.js 5:0-22
@ ./node_modules/hbo-dnsd/named.js 6:20-39
@ ./node_modules/dns/lib/dns.js 2:17-36
@ ./node_modules/tedious/lib/connection.js 12:34-48
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/configuration/mode/
1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
ERROR in ./node_modules/js-md4/src/md4.js 117:17-34
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\js-md4\src'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
@ ./node_modules/tedious/lib/ntlm-payload.js 12:35-52
@ ./node_modules/tedious/lib/connection.js 36:42-67
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/native-dns-cache/lookup.js 21:12-28
Module not found: Error: Can't resolve 'dgram' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\native-dns-cache'
@ ./node_modules/native-dns-cache/index.js 3:0-50 4:0-60 5:0-68
@ ./node_modules/native-dns/lib/platform.js 28:12-39
@ ./node_modules/native-dns/dns.js 23:0-44
@ ./node_modules/dns/lib/dns.js 3:17-38
@ ./node_modules/tedious/lib/connection.js 12:34-48
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/native-dns/lib/platform.js 23:9-22
Module not found: Error: Can't resolve 'fs' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\native-dns\lib'
@ ./node_modules/native-dns/dns.js 23:0-44
@ ./node_modules/dns/lib/dns.js 3:17-38
@ ./node_modules/tedious/lib/connection.js 12:34-48
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/native-dns/lib/server.js 23:12-28
Module not found: Error: Can't resolve 'dgram' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\native-dns\lib'
@ ./node_modules/native-dns/dns.js 25:0-59 26:0-65 27:0-65
@ ./node_modules/dns/lib/dns.js 3:17-38
@ ./node_modules/tedious/lib/connection.js 12:34-48
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/native-dns/lib/utils.js 21:12-28
Module not found: Error: Can't resolve 'dgram' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\native-dns\lib'
@ ./node_modules/native-dns/lib/server.js 27:16-44 28:16-44
@ ./node_modules/native-dns/dns.js 25:0-59 26:0-65 27:0-65
@ ./node_modules/dns/lib/dns.js 3:17-38
@ ./node_modules/tedious/lib/connection.js 12:34-48
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/tedious/lib/connection.js 8:37-54
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\tedious\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/tedious/lib/ntlm-payload.js 10:37-54
Module not found: Error: Can't resolve 'crypto' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\tedious\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "crypto": require.resolve("crypto-browserify") }'
- install 'crypto-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "crypto": false }
@ ./node_modules/tedious/lib/connection.js 36:42-67
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
ERROR in ./node_modules/tedious/lib/sender.js 9:36-52
Module not found: Error: Can't resolve 'dgram' in 'C:\Users\Administrator\Desktop\Node_Word\node_modules\tedious\lib'
@ ./node_modules/tedious/lib/instance-lookup.js 13:14-33
@ ./node_modules/tedious/lib/connection.js 26:22-50
@ ./node_modules/tedious/lib/tedious.js 59:41-64
@ ./js/server.js 175:17-46
8 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.76.1 compiled with 8 errors and 2 warnings in 27216 ms