Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to load next.config.js

After cloning the repository I created and set my .env.local file, ran npm i then ran npm run dev. The server starts, env is loaded from .env.local however it immediately fails prompting me with the following:

error - Failed to load next.config.js, see more info here https://nextjs.org/docs/messages/next-config-error
Error: Not supported
    at Object.loadConfig [as default] (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\config.js:399:74)
    at async NextServer.loadConfig (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:110:22)
    at async NextServer.prepare (C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\server\next.js:92:24)
    at async C:\Users\Nick\Desktop\rebuild\node_modules\next\dist\cli\next-dev.js:126:9
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `next dev`
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:\Users\Nick\AppData\Roaming\npm-cache\_logs\2021-10-29T19_47_30_427Z-debug.log

The NextJS documentation says: See the error message in your terminal where you started next to see more context. however all it is telling me is Not Supported.

I'm not familiar with the error and was looking for guidance.

like image 863
Nick Avatar asked Oct 29 '21 19:10

Nick


People also ask

What is next config js file?

config. js is a regular Node. js module, not a JSON file. It gets used by the Next. js server and build phases, and it's not included in the browser build.

Is next JS using Webpack?

Next. js has adopted webpack 5 as the default for compilation. We've spent a lot of effort into ensuring the transition from webpack 4 to 5 will be as smooth as possible.

Does Next JS require node JS?

You don't need a node server running 24/7 for hosting your application. Also, if you don't use getServerSideProps, Next. js by default will pre-render your page, this page gets cached on a CDN. So yes you can make API calls to your PHP backend, without the need for a setting up a nodejs server yourself.


2 Answers

I ended up uninstalling Node and everything related to it. Reinstalled with Node v14.0.0 and it seemed to work.

Thanks all for your help!

like image 88
Nick Avatar answered Oct 14 '22 20:10

Nick


I solved this by upgrading to the latest version of nodeJS

like image 23
Niana Avatar answered Oct 14 '22 22:10

Niana