gpt4 book ai didi

javascript - ValidationError : Invalid configuration object. Webpack 已使用与 API 架构不匹配的配置对象进行初始化。 Next.js

转载 作者:行者123 更新时间:2023-12-04 02:25:25 29 4
gpt4 key购买 nike

我用了create-next-app创建我的 next.js 项目样板。但是一旦我运行 npm run dev我得到错误:

ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration[0].node should be one of these:
false | object { __dirname?, __filename?, global? }
-> Include polyfills or mocks for various node stuff.
Details:
* configuration[0].node has an unknown property 'fs'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration[0].node has an unknown property 'devServer'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
- configuration[1].node should be one of these:
false | object { __dirname?, __filename?, global? }
-> Include polyfills or mocks for various node stuff.
Details:
* configuration[1].node has an unknown property 'fs'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
* configuration[1].node has an unknown property 'devServer'. These properties are valid:
object { __dirname?, __filename?, global? }
-> Options object for node compatibility features.
at validate (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\compiled\schema-utils3\index.js:1:153657)
at validateSchema (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\compiled\webpack\bundle5.js:137945:2)
at create (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\compiled\webpack\bundle5.js:141384:24)
at webpack (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\compiled\webpack\bundle5.js:141426:32)
at f (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\compiled\webpack\bundle5.js:98978:16)
at HotReloader.start (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\server\hot-reloader.js:18:415)
at async DevServer.prepare (C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\server\next-dev-server.js:16:453)
at async C:\Users\crisp\OneDrive\Documents\Next.js\next-startup\nextflix\node_modules\next\dist\cli\next-dev.js:22:1 {
errors: [
{
keyword: 'anyOf',
dataPath: '[0].node',
schemaPath: '#/anyOf',
params: {},
message: 'should match some schema in anyOf',
schema: [Array],
parentSchema: [Object],
data: [Object],
children: [Array]
.....
我的 next.config.js看起来如下。
module.exports = {
webpack: (config) => {
config.node = {
fs: 'empty'
}
return config
}
};
什么都没有改变。这是默认设置。请您向我解释为什么我会收到此错误。
任何帮助输入将不胜感激。

最佳答案

您能否检查 Nextjs 11 上的任何依赖项需要更新。
在我的情况下更新 next-transpile-modules到版本:^8.0.0解决了这个问题。

关于javascript - ValidationError : Invalid configuration object. Webpack 已使用与 API 架构不匹配的配置对象进行初始化。 Next.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68038511/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com