我現在正在做一個反應和節點專案,但我得到了這個:
Compiled with problems:X
ERROR in ./node_modules/ip/lib/ip.js 7:9-22
Module not found: Error: Can't resolve 'os' in '/home/jacob/Code/taekwondo-bulletin/node_modules/ip/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: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ./node_modules/mongodb/lib/cmap/auth/gssapi.js 8:12-26
Module not found: Error: Can't resolve 'dns' in '/home/jacob/Code/taekwondo-bulletin/node_modules/mongodb/lib/cmap/auth'
ERROR in ./node_modules/mongodb/lib/cmap/auth/mongocr.js 8:15-32
Module not found: Error: Can't resolve 'crypto' in '/home/jacob/Code/taekwondo-bulletin/node_modules/mongodb/lib/cmap/auth'
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 }
ERROR in ./node_modules/mongodb/lib/cmap/auth/mongodb_aws.js 8:15-32
Module not found: Error: Can't resolve 'crypto' in '/home/jacob/Code/taekwondo-bulletin/node_modules/mongodb/lib/cmap/auth'
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 }
ERROR in ./node_modules/saslprep/lib/memory-code-points.js 3:11-24
Module not found: Error: Can't resolve 'fs' in '/home/jacob/Code/taekwondo-bulletin/node_modules/saslprep/lib'
ERROR in ./node_modules/socks/build/client/socksclient.js 42:12-26
Module not found: Error: Can't resolve 'net' in '/home/jacob/Code/taekwondo-bulletin/node_modules/socks/build/client'
ERROR in ./node_modules/socks/build/common/helpers.js 12:15-32
Module not found: Error: Can't resolve 'stream' in '/home/jacob/Code/taekwondo-bulletin/node_modules/socks/build/common'
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: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
我對這個專案沒有任何改變,第二天就回來了,這正在發生。我試過洗掉并重新安裝 node_modules 和 package-lock.json。我似乎在互聯網上找不到任何類似的東西,并且已經卡了好幾天了。任何幫助,將不勝感激。mongodb 有更多錯誤,但被視為垃圾郵件。
uj5u.com熱心網友回復:
這是因為一些包是 Node.js 的一部分,但它們在瀏覽器中不存在。
您需要指出它們或將它們設定為 false。
更新你的 webpack 配置,將你遇到錯誤的包設定為 false:os、dns、crypto、fs、net。或者更好的是,添加所有這些:
resolve: {
fallback: {
"child_process": false,
"process": false,
"fs": false,
"util": false,
"http": false,
"https": false,
"tls": false,
"net": false,
"crypto": false,
"path": false,
"os": false,
"stream": false,
"zlib": false
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/445955.html
標籤:javascript 节点.js 反应 mongodb 网页包
上一篇:在帶有@expo/vector-icons的monorepo中使用next.js和next-fonts自定義webpack配置
