Unable to start new Nextjs application Failed to load next.config.js - reactjs

I pulled a nextJS application from git and tried starting it using npm run dev ,npx next dev npm run start, matter of fact, every single command I ran gave me the same error.
To further troubleshoot, I followed a youtube tutorial and I started a brand new project ran npx create-next-app appname and again. Same error.
H:\Documents\Projects\React\NextTutorial\ninjalist>npm run dev ninjalist#0.1.0 dev next dev ready - started server on 0.0.0.0:3000, url: http://localhost:3000 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] (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\config.js:399:74) at async NextServer.loadConfig (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\next.js:110:22) at async NextServer.prepare (H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\server\next.js:92:24) at async H:\Documents\Projects\React\NextTutorial\ninjalist\node_modules\next\dist\cli\next-dev.js:126:9
Most prominent is it's failing to load next.config.js
and the contents of that file is simply
/** #type {import('next').NextConfig} */ module.exports = { reactStrictMode: true, }
Appreciate if I could be informed on what i'm missing cause I have not written any code, this is straight from the create app and I am getting this error.
Gratitude for the assistance.

Dont waste even a single minute. Just update to the latest version of node

Solved it by upgrading to the latest version of NodeJS

Related

whenever I try to run my project I keep getting the development server returned http response code 500 for url in react native

this problem occurred after deploying sanity to my project(I don't know if its the source of the problem but just wanted to share it.)
[This is what I see in the emulator]
(https://i.stack.imgur.com/otbGz.png)
and the following is what appears in the terminal:
Error: Duplicated files or mocks. Please check the console for more info
at setModule (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:553:17)
at workerReply (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:624:9)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 27260)
at /home/faisalmwy/development/react-native/food-delivery/node_modules/metro-file-map/src/index.js:395:22
at DependencyGraph.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/node-haste/DependencyGraph.js:94:5)
at Bundler.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/Bundler.js:75:5)
at IncrementalBundler.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/IncrementalBundler.js:327:5)
at Server.ready (/home/faisalmwy/development/react-native/food-delivery/node_modules/metro/src/Server.js:1247:5)
I've searched for this problem before, some said delete the package-lock.json and node_modules, but it didn't work. others said reinstall npm all together. that didn't work also. I also tried running the app on a different localhost that usual, since sometimes me and a friend of mine connect in the same time.
Have you tried to stop the application and do the below process:
cd android and gradlew clean
remove node_modules and package-lock.json
run npm i
also remove application from simulator or from your device
rerun application

React server won't start after installing styled-components

Disclaimer: this is my first question on Stack Overflow, so apologies if it's not formatted correctly. Please let me know how I can improve it or if more details are needed.
I tried to install styled-components for my React app with the following command npm install --save styled-components.
Before I did this, my server started up just fine with npm start.
After install, React tries to start up the development server but it stops and returns the following errors:
cacheEntry.sizeOnlySource = new SizeOnlySource(size);
TypeError: SizeOnlySource is not a constructor
at updateFileWithReplacementSource (project-directory/node_modules/webpack/lib/Compiler.js:756:37)
at updateWithReplacementSource (project-directory/node_modules/webpack/lib/Compiler.js:738:8)
at processMissingFile (project-directory/node_modules/webpack/lib/Compiler.js:801:8)
at project-directory/node_modules/webpack/lib/Compiler.js:843:10
at Immediate.<anonymous> (project-directory/node_modules/memfs/lib/volume.js:698:17)
Initially, I tried uninstalling the styled-components package. Same errors. Then, I tried updating webpack with npm update webpack.
I googled the errors but they were all for problems that seemed unrelated or that are now fixed.
Support Webpack 4.29.0 breaking change
output.futureEmitAssets option breaks compatibility with source map upload plugins
library target umd - Uncaught TypeError: x is not a constructor
I did come across a post on Stack Overflow explaining that --save is no longer necessary as of npm version 5.0.0. Perhaps it's the source of the error?
Note that I installed the styled-components package on a separate branch of my project, but the server still won't start when I switch to the main branch and I'm getting the same errors.
Honestly, I have no idea what's going wrong or how to fix it. Any help or guidance would be greatly appreciated.
Edit: before the Starting development server... line I get after running npm start, there's some kind of message about webpack being deprecated. I hadn't noticed that before, but it flashes by too quickly for me to read it and I can't scroll up to see the message. I created a new React project from scratch to see if the server would start. It does, but I'm still getting the aforementioned messages.

npm run deploy failure when deploying React app to Github

Problem:
I am still very new to React and am trying to push my React app onto Github, but I keep running into an error when I deploy it on my console.
Set Up:
I am using Atom on a Windows 10 computer. I created my React app by using the commands, npx create-react-app jordon. I then followed the steps in this youtube tutorial. This is what my package.json looks like after following the tutorial:
I then went through the steps to initialize a github repository. However, after running npm run deploy, I come across an error:
I have tried to rerun the steps in the tutorial time after time, but either receive the same error, or an error that is resolved by uninstalling gh-pages from the folder but leads to the same error. At this point, I have not found any resources that would help me, since most people seem to have successfully ran the npm run deploy command. Any help would be much appreciated!

React new project does not re compile on save

I've created a new react app using create-react-app. running npm start compile the app and opens the hello react page on localhost://3000, but any change to the project and saving nothing happens.
in the chrome console there is the following error:
Error handling response: Error: Failed to construct 'WebSocket': The URL 'ws/ws' is invalid.
at init (chrome-extension://fiegdmejfepffgpnejdinekhfieaogmj/reload.js:22:18)
at chrome-extension://fiegdmejfepffgpnejdinekhfieaogmj/reload.js:65:13
I'm using Visual studio on Macbook
npm version 6.14.8
node version 14.15.1
react version 17.0.1
(Angular cli project re-compile without a problem)
Deleting the app and running create-react-app again solved the problem.
The initial screen looks different though - so maybe it was a version compatibility issue.

yarn test - Network request failed [duplicate]

This question already has an answer here:
Yarn test failing - Network request failed
(1 answer)
Closed 5 years ago.
created a react project using create-react-app however when I go to run yarn test to see if the initial tests pass I get
/home/afenwick/Development/road-to-react-learning/node_modules/react-scripts/scripts/test.js:22
throw err;
^
TypeError: Network request failed`
error Command failed with exit code 1.
If I set up a brand new app it works totally fine, have not made any changes to App.test.js, just trying to run the default test. yarn start works fine, spins up my app in the browser.
Have tried deleting node_modules
Also tried npm install instead and npm run tests but that doesnt install my dependencies and then also errors the tests.
OS: Antergos Linux
Github repo: https://github.com/Fenwick17/road-to-react-learning
Stepped through my commits to locate the issue, and appears to be caused in https://github.com/Fenwick17/road-to-react-learning/commit/4b6069181a39861e531b550ebb8689695db042bb so I will work through the changes to rectify.
I also ran into this problem when following the book entitled "The Road to Learn React" and I think that the one causing this error is the part where fetch is called. The book forgot to include an import for fetch which is this one:
import fetch from 'isomorphic-fetch'
Then, it solves my problem like a charm. Hope this help.

Resources