Encountered an error while trying to load next.config.js - Specifically, a TypeError: The options

Need Help!

I encountered an issue while trying to run my nextapp with antd design. It's giving me an error about needing a less loader, so I checked out this https://github.com/SolidZORO/next-plugin-antd-less and also this https://github.com/elado/next-with-less, but I still couldn't resolve it.

> 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! [email protected] dev: `cross-env NODE_OPTIONS="-r esm" next -p 3333`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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

System Details:

  • Node v12.22.0
  • NextJs v12.1.4
  • React v17.0.2

My 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
  }
});

Answer №1

To start, it seems like updating your node version to at least 14.x is necessary.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discovering a solution to extract a value from an Array of objects without explicitly referencing the key has proven to be quite challenging, as my extensive online research has failed to yield any similar or closely related problems

So I had this specific constant value const uniqueObjArr = [ { asdfgfjhjkl:"example 123" }, { qwertyuiop:"example 456" }, { zxcvbnmqwerty:"example 678" }, ] I aim to retrieve the ...

What are some ways I can improve the readability of this if-else function in Javascript ES6?

As a newcomer to React development, I am currently in the process of tidying up my code. One issue that I am facing is how to deal with a particular function while minimizing the use of if-else statements. const calculatePerPage = () => { if ...

Background and checked styles for radio buttons

Thank you in advance for any assistance you can provide. I am looking to create a unique radio button design. When the radio button is not checked, I want it to display as a simple white circle. However, once it is checked, I would like it to appear eithe ...

The validation feature is ineffective when used with Material UI's text input component

I need a function that can validate input to make sure it is a number between 1 and 24. It should allow empty values, but not characters or special symbols. function handleNumberInput(e) { const re = /^[0-9\b]+$/; const isNumber = re.test(e.target.val ...

Webpack focuses solely on serving HTML files, neglecting to deliver the underlying code

Hey there! I'm currently working on a project that involves using React, TypeScript, and Webpack. I ran into some errors previously that prevented the code from compiling, but now that's fixed. However, when I run webpack, it only serves the HTML ...

Creating a customized TextField look with styled-components and Material-UI's withStyles feature

Take a look at this customized TextField style with Material-UI's withStyles: export const StyledTextField = withStyles({ root: { background: 'white', '& label.Mui-focused': { color: 'white' }, ...

Make sure to consistently receive the distinct key notice: Every child within a set must possess a unique "key" property

Trying to understand the part of this code that suggests I don't have keys for the pushed array items: import { Accordion, AccordionSummary } from '@material-ui/core' import { createStyles, makeStyles, Theme } from '@material-ui ...

Utilizing various Tailwind configuration files in a single NextJS project

Is it feasible to implement two separate configurations (tailwind.css) for two distinct NextJS layouts? I am looking to have a frontend-tailwind.js and a backend-tailwind.js in order to create two unique style sheets - backend.scss and frontend.scss withi ...

"Uh-oh! Encountered a new unexpected runtime error. Can't seem

While working on my portfolio in Next.js, I encountered an issue. I added a header to display on all pages by placing it in _app.js without making any changes to _document.js. Here is the error message: Unhandled Runtime Error Error: No router instance fo ...

The issue of the back button not functioning in the React Multi-level push menu SCSS has

I have been developing a mobile-friendly Multi-level push navigation menu for my website using dynamically generated links based on projects from my GitHub account. I found a push menu on CodePen here and am in the process of integrating it into React inst ...

Passing onClick event to parent component during iteration in ReactJS

I am facing a challenge where I need to remove a row from a table upon a click event. I have managed to create an iteration and display a delete button, but I am struggling with passing the onClick event from the parent component to the child component in ...

Combining two react functions in a synchronized manner

I'm facing a React coding challenge. I need to combine the handleUpdate and handleUpload functions in a synchronous manner so that the state is updated before the function continues executing. I attempted the following code snippet with my suggested e ...

Tips on adjusting font size of material ui badge text in reactjs?

I am attempting to adjust the font size of the label within a material ui badge. The current method I am using, style={{ fontSize: "15" }}, only impacts its child element, which happens to be an icon. Sample Code: <Badge badgeContent={props.c ...

Combining React, Express, and Nodemailer poses challenges in rendering components and sending emails simultaneously

Looking to utilize client-side routing for my React app and also incorporate Nodemailer for sending emails. However, since Nodemailer cannot be used on the client-side, I need to implement it on the Express server. Here is how the server code looks like: ...

Enhance your React project by incorporating Material-UI card media elements with the ability to add

I am trying to figure out how to create an opaque colored overlay on top of an image using Material-UI. While it is possible with plain HTML, CSS, and JavaScript, I am facing some challenges with Material-UI. <Card> <CardMedia> <im ...

Error TS2694 is being caused by Electron Typescript Material-UI withStyles because the namespace "".../node_modules/csstype/index"" does not have an exported member called 'FontFace'

While I am experienced with Material-UI, I am relatively new to Electron and using React, TypeScript, and Material-UI together. Recently, I encountered an error while attempting to create an electron boilerplate code for future project initialization. Init ...

Looking to organize and sum up values in DataTable REACT – is there a way to achieve this

I have a script that I'm working with and I want to group the data by the AKONT field and then totalize it based on the UM01S field. Is this something that can be done? const options = { UM01S: (item) => <td>{formatColumn('currency' ...

Strategies for efficiently handling time in React and Node.js without being impacted by timezone issues

Despite exhausting all methods to assess time in my mern application, I have yet to find a solution. My search online has also been fruitless... ...

From jQuery to ReactJS: Migrating to a Modern

As I venture into converting existing jQuery code to React.js, I must admit that I am quite new to React and still in the learning phase. So please bear with me if my questions sound a bit silly. Here is the structure I am working with: <ul> &l ...

The error message in Next.js keeps popping up because it detects that I am using a non-standard NODE_ENV, even though I have already

Upon deploying my Next.js project within a Docker linux container, an issue arises during startup where Next.js alerts that You are using a non-standard "NODE_ENV" value in your environment. Even though the NODE_ENV is configured as development, ...