无法加载next.config.js - TypeError:主机定义的选项无效

2nc8po8w  于 2023-08-04  发布在  其他
关注(0)|答案(1)|浏览(106)

发生了什么?

我试着运行我的nextapp与antd设计,它说少需要加载器,然后我发现这个https://github.com/SolidZORO/next-plugin-antd-less和这个https://github.com/elado/next-with-less。还是没有成功

> cross-env NODE_OPTIONS="-r esm" next -p 3333

ready - started server on 0.0.0.0:3333, url: http://localhost:3333
error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
TypeError: Invalid host defined options
    at Object.loadConfig [as default] (C:...\node_modules\next\dist\server\config.js:70:78)
    at async NextServer.loadConfig (C:...\node_modules\next\dist\server\next.js:114:22)
    at async NextServer.prepare (C:...\node_modules\next\dist\server\next.js:96:24)
    at async C:...\node_modules\next\dist\cli\next-dev.js:127:9
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nextjs-concept@2.0.0 dev: `cross-env NODE_OPTIONS="-r esm" next -p 3333`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nextjs-concept@2.0.0 dev 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:...\AppData\Roaming\npm-cache\_logs\2022-04-12T03_39_00_931Z-debug.log

字符串

套餐:

  • 节点v12.22.0
  • NextJs v12.1.4
  • React v17.0.2
    我的next.config.js
/* eslint-disable */
const withPlugins = require('next-compose-plugins');
const withAntdLess = require('next-plugin-antd-less');

const pluginAntdLess = withAntdLess({
  lessVarsFilePath: './src/styles/variables.less'
});

module.exports = withPlugins([[pluginAntdLess]], {
  webpack(config) {
    return config
  }
});

whitzsjs

whitzsjs1#

首先,我猜您需要将节点版本升级到至少14.x

相关问题