./node_modules/ip/lib/ip.js 7:9-22 中的错误

ERROR in ./node_modules/ip/lib/ip.js 7:9-22 React

我现在正在做一个反应和节点项目,但我得到这个:

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 有更多错误,但被视为垃圾邮件。

那是因为有些包是 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
}

}