Getting started with Create React App - "Cannot find module" - node.js

I'm using the "Getting Started" guide because I've been experiencing endless errors trying to create a react app so far when following tutorials.
And straight away I'm running into a problem. When I run npx create-react-app my-app I get the following:
Cannot find module 'C:\Users\Aristophanes\node_modules\create-react-app\index.js'
Can anyone advise me what I'm doing wrong? Thanks.

This must be a problem related with your node installation (maybe you removed manually create-react-app package?). I'd recommend following these steps:
Uninstall node and npm
Delete the npm cache and npm modules in your machine (In Windows machine you can usually find them at C:\Users\ {username} \AppData\Roaming\npm-cache and C:\Users\ {user name} \AppData\Roaming\npm) respectively.
Install node and npm again
If you really don't want to delete node and npm, try step 2 and see if that works. Following these steps did the job for me, hope that helps you.

I think you might miss installing Node and npm in your machine.

I had same issue a few times. Every time I was searching thru net for a solution, and for every time i just typed in terminal
npm i node
and its just started working

Related

create-react-app ; aborting installation while creating react app in windows 11 after installing node js

I installed node js and create-react-app in my system and while performing the command to create the startup react project, i performed, npx create-react-app <projectname> command. But it failed all the time and i don't know how to proceed with this and i tried some of the already available solutions and nothing worked and i don't know how to proceed with this. I have attached the screenshot of the error. Have a look at it and help me with the solution.
create-react-app_click_here_to_see_my_terminal_image
Thanks in advance !!!

I cannot start my nestjs project after a reboot

I don't know what happened prior to this issue but after each reboot i have to fully remove npm and nodejs, reinstall both npm and nodejs in order to start my nestjs project.
After rebooting running the npm run start command in my nestjs project, npm stops halfway and exits without any error codes (Link below of the terminal output).
https://i.stack.imgur.com/zrbXp.png
What could it be? Is there perhaps some system path that gets wiped on reboot?
Any help or pointers would be greatly appreciated
Turns out both my angular project and my nestjs project required me to run a very specific version of node. anything else resulted in a silently crashing nestjs application with no errors.
For anyone stumbling into the same problem try fiddling around with the node version you're running
npm install -g n
n 10

Nodejs module not found

I'm trying to install socket.io on localhost.
I installed nodejs like this:
1. npm install pm2 -g
2. npm install socket.io
3. pm2 start C:\xampp\htdocs\server\app.js
Yesterday It was successful and I worked on my project.
But today when I start same file again, I get an error like this;
https://i.imgur.com/V89qWhP.png
And I open logs, the message showed:
https://i.imgur.com/pLj5dgx.png
I'm trying to solve this problem for hours.
I even tried to reinstall Node at least 4-5 times.
Still same problem, please help.
At first glance I would recommend you to run a npm install before starting your app.
We need additional information about your require statement, your package.json dependencies and the full error message.

Different NPM version used when generating React app

When I try to create the starter React tutorial app using powershell, I get the below error:
"You are using npm 2.15.12 so the project will be boostrapped with an old unsupported version of tools".
"Please update to npm 3 or higher for a better, fully supported experience".
However, my NPM version is 6.11.3 as seen below.
What I have tried:
I have ran powershell as admin as answered in this question and restart.
I have also uninstalled and reinstalled Nodejs completely.
So after an extra hour digging around, I saw a few posts with similar (but not exactly) the same issue. I decided to install Yarn and install with that.
After install, I ran yarn cache clean and ran npx create-react-app your-app and it worked. Sorry for bothering you all.
I had the same problem. I'm running WSL with ubuntu, and yarn cache clear didn't work, but I noticed a node modules directory created in the project. I think it was messing with the node version so I deleted it. It worked

Installing and Using Node JS in My Project

Im very very new in NodeJS
I want to ask about installing and using it in my Project..
I've installed nodejs in my Windows, but I have no idea how to make it works in my Cordova/Phonegap Project. I want to install this module in my project node-gcm. it said I just have to execute npm install node-gcm --save but I dont know where should I execute that command so I tried executed it on my project root (/www). After that I tried the example application code to use it but It said that require is not defined. Can anyone tell me how to fix this?
You need to learn nodejs properly to use in your project. I would recommend the below site could be a good starting point for you which covers all the basics.
http://www.tutorialspoint.com/nodejs/
You are getting that error because, when you look at the package.json file of the node-gcm package, you will notice the dependencies mentioned as,
If you are a windows user, you need to get into your node_modules directory by giving cd node_modules command in your command line and then just issue this command npm install which will install all the required packages.
Hope this helps!.

Resources