Npm start doesnt work after I create a react app - node.js

I'm following a youtube react tutorial and what I did was npx create-react-app my-app Once this was done I cd'ed into my-app and tried to npm start like the tutorial showed. I got an error saying
-npm ERR! missing script: start
I also saw that the person in the tutorial had a public and a source folder. I only have the node_modules folder and package-lock.json and package.json. Why am I missing the public and source folders and why cant I npm start?

I had the same issue and solved it running : npm uninstall -g create-react-app.
Thanks to the -g (aka 'global' attribute) you can run this terminal command no matter the directory you find yourself.
Then go in the directory you would like to find your project and run npx create-react-app my-app again!

Related

error found when we install npx create-react-app

enter image description here
I don't know why these error come when we simply write command create-react-app so please solve this error I want to made my project as soon as possible.
Follow this steps and see.
Install Node (https://nodejs.org/en/download/)
npm i -g
create-react-app
create-react-app your-app-name
Follow Steps: -
Install Node.js in your machine (https://nodejs.org/en/download/)
create folder with your project name
Right click on folder open VS-CODE
open VS-Code's terminal
cd projectname
npx create-react-app .

Error follow storybook steps to create a libary with react

I'm try to create my libary follow this steps on Storybook' site:
npx create-react-app taskbox
cd taskbox
npx -p #storybook/cli sb init
When I run "npm start" the app works fine, but when I run "npm run storybook" I'm given this error on terminal:
Terminal error
I'm using node 16.13.1
Help me please.
UPDATE
A better image about the error
From this post it seems that the following tactics worked:
npm i --save-dev #storybook/react
npm i -D #storybook/cli
Some also say you need to re install your node modules using:
npm install
and then using this instead after:
npm start-storybook
it seems like the tech has some faults and the bulk of the people said :
I kind of solved the issue. I think the issue was due to the file system. I restarted my system and then again reinstalled storybook. Worked like a charm.

why i am not able to install all the dependencies in react?

enter image description hereI tried running all the commands including npx create-react-app npm create-react-app npm install npm clear cache --f everything.
still i am not able to install all the dependencies in my package json
The fact that a package is asking for funding should not affect your installation. It simply means that the author(s) is/are looking for financial support to continue their work.
To create a new installation and avoid possible issues - go to a new directory and type the following on your command prompt:-
npx create-react-app todo1
Then, you need to navigate to the folder of your newly created app, "todo1" by running the following:
cd todo1
Finally to run the app, type the following:
npm start
First I want to say your commands are not clear and those are not separated. I assume you need to create react app with npm package manager.
If you run npx create-react-app todo1 you will create a react app with yarn dependency manager.
If you need to use npm dependency manager use the following command
npx create-react-app todo1 --use-npm
Then check the root directory. it should have the package.json file with necessary initial dependencies.

npx react-native init AwesomeProject error enolocal

i got an error while trying to create react native app using npx npx
react-native init AwesomeProject
like the docs said. But i got an error messages
npm ERR! code ENOLOCAL npm ERR! Could not install from
"Indigo\AppData\Roaming\npm-cache_npx\3192" as it does not contain a
package.json file.
npm ERR! A complete log of this run can be found in:
C:\Users\Durio
Indigo\AppData\Roaming\npm-cache_logs\2020-07-08T08_20_54_191Z-debug.log
Install for react-native#latest failed with code 1
i know it's not from the npx because i tried to create react app with npx and it works. Am I the only one who had this?
This is an issue in node which is caused by white space in user name between first-name and last-name in windows.
run the following command after replacing firstname with your windows user firstname in command prompt with administrator access
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global
I had you try npm cache clear and if using windows you can run command npx react-native init AwesomeProject in Command promt using Run as Administrator
I have faced the same issue, do nothing just a quick fix.
first, run the command npm i react-native#latest -g then create your project with your command i.e npx react-native init myProject
we should check the android SDK path on environment variable. Make sure there is no white space on the SDK path and platform-tools path

npm and other modules commands not working

Note: I am on Windows 10 64 bit running the latest LTS Node build.
It all started when I tried running the command npm i -g create-react-app and I get a message saying that npm is not a command.
I checked my PATH and I believe I have the proper directories in there.
I navigated to the directory of npm and tried running the command again, but it still didn't work. I found that the command npm.cmd worked in any directory. So tried running npm.cmd i -g create-react-app and that worked! I also had to use the the command create-react-app.cmd my-app, instead of create-react-app my-app. I thought I was set and I could just use those .cmd commands for the things I needed to do; however, when I tried to run the command create-react-app.cmd my-app and got this as a result:
I have looked in the file that is ran when using this command create-react-app.cmd my-app and there is no sign of npm being called. Turns out Node is being called in that file with the command below. I know this because when I run it by itself and I get the same output to the console seen in the previous image.
"node" "C:\Users\Allen\AppData\Roaming\npm\\node_modules\create-react-app\index.js" my-app
it was called in the create-react-app.cmd file like this "%_prog%" "%dp0%\node_modules\create-react-app\index.js" %*
I am at a loss. I could continue down this rabbit hole and try and find the node file that is calling npm and change it to npm.cmd but I would rather find a way to get the npm and create-react-app commands working as they are suppose to. At the very least I can just spin up a VM and work in that. It is just annoying that I can't get Node to work properly for me.
Use the command npx create-react-app my-app this will help you create react projects.
Also check the documentation : https://reactjs.org/
First check that you have npm installed on your machine and the version. You can just type npm version. Since npm version 5.2.0 npx is pre-bundled with npm, which is a CLI tool whose purpose is to make it easy to install and manage dependencies hosted in the npm registry. So try using npx create-react-app app-name. You can confirm that you are able to use npx by running which npx. If it is not available then you can install it by running npm install -g npx.

Resources