yarn install wont run on my project keeps telling me that it couldn't find the binary react-script start - reactjs

my package.json
the error i get
all my scripts dont work it keeps throwing the same error everytime.
i have cloned the repo in a different location and reinstalled the dependencies but still yarn start wont run.
what could be the problem?

try running your project with this yarn run start or just add react-scripts with yarn using this command yarn add react-scripts because maybe react-scripts is not installed for some reason

Related

npm start command not found in create-react-app -- how to add to package.json? [duplicate]

I cloned a react application onto my system and ran following commands
npm install -g create-react-app
npm install --save react react-dom
After that i ran
npm start
But it threw the above mentioned error, It is working fine on my other system from which i pushed it on github. But it is not working on any other system after cloning whether windows or mac.
Check if node_modules directory exists. After a fresh clone, there will very likely be no node_modules (since these are .gitignore'd).
Solution
run npm install (or yarn) to ensure all deps are downloaded.
Alternative Solution
If node_modules exists, remove it with rm -rf node_modules and then run npm install (or yarn).
Tried all of the above and nothing worked so I used npm i react-scripts and it worked
I had similar issue. In my case it helped to have Yarn installed and first execute the command
yarn
and then execute the command
yarn start
That could work for you too if the project that you cloned have the yarn.lock file. Hope it helps!
In package.json, I changed
"start": "react-scripts start"
to
"start": "NODE_ENV=production node_modules/react-scripts/bin/react-scripts.js start"
I hope this solves the problem for some people. Although the other solutions above seem not to work for me.
you should not install react-scripts globally, for me this fixed the problem:
npm install --save react react-dom react-scripts
if this still dont work :
update to latest npm version : npm install -g npm#latest
delete node_modules directory
reinstall all dependencies : npm install
https://github.com/facebookincubator/create-react-app
npm install -g create-react-app
create-react-app my-app
cd my-app/
npm start
You install the create-react-app package globally.
After that you run it and create a project called my-app.
Enter your project folder and then run npm start. If that doesn't work try running npm install and then npm start. If that doesn't work as well, try updating your node version and/or npm.
I had this problem for ages and I eventually found my solution by sheer chance.
Turns out, you can't have spaces or wacky characters in any folder names.
e.g.
~/projects/tutorial/ReactJS/JavaScript Framework: ReactJS/app-name
won't work because JavaScript Framework: ReactJS contains spaces.
In general, it's probably not great practice to be using spaces in folder/file names anyway but I hope this saves someone at least 4 hours of trial and error.
Also, any non-alphanumeric characters should be avoided.
This error occurs when you Install package with npm install instead of yarn install or vice-versa.
using npm i --legacy-peer-deps worked for me.
I do not know specifically which operation out of the following it performed:
Installing the peer dependencies' latest stable version.
Installing the peer dependencies' version which the core dependy you are installing uses.
But I think it performs the latter operation. Feel free to let me know if I'm wrong ^-^
npm install --save react react-dom react-scripts
Above command worked for me.
This boggles me time to time when I have a fresh start with create-react-app, please make sure your NODE_ENV variable is set to development not production, as devDependencies in your package.json will not be installed by npm install.
If you are having this issue in a Docker container just make sure that node_modules are not added in the .dockerignore file.
I had the same issue sh1 : react scripts not found. For me this was the solution
Just ran into this problem after installing material-ui.
Solved it by simply running npm install again.
Just doing an Yarn install solved the problem for me
Deleting package-lock.json and node_modules then npm install worked for me.
If none of the other answers work properly (after updating the npm etc). I would strongly recommend you to install the project on your desktop.
create-react-app project_name
The solution that worked for me is below. Try creating React app with this command.
create-react-app react-app --scripts-version 1.1.5
this worked for me.
if you're using yarn:
delete yarn.lock
run yarn
and then yarn start
if you're using npm:
delete package-lock.json
run npm install
and then npm start
If anyone still have this problem after trying these solutions: check your project path as node has some issues working with spaced dir names. I changed all directories names that had spaces in their names and it worked perfectly.
solution idea taken from: https://npm.community/t/react-scripts-not-found/8574
i am using yarn BTW
You shoundt use neither SPACES neither some Special Caracters in you path, like for example using "&". I my case I was using this path: "D:\P&D\mern" and because of this "&" I lost 50 minutes trying to solve the problem! :/
Living and Learning!
If you have tried everything and nothing solved it, try to rename the directories name. react will not start if the folder's name contains uppercase letters.
After spending too much time trying all the solutions above, I can say for sure:
If you ran into this issue, check your path. If the path contains any special character or spaces just rename it and make sure that the new path doesn't have any spaces or special character. Then run it again .
delete node_modules
run npm install
after that run npm start
if above does't work
delete node_modules
delete package-lock.json
run npm install
and then npm start
if above solutions does not fixed your problem, try the following this worked for me:
if you want to start on another port or PORT command not found error then do the following steps:
open package.json file
inside script replace the start command with below
"start": "set PORT=3006 && react-scripts start"
To change the port of your app, you can also create a new file name .env in the root directory of the project and write in it PORT=3006 (then save the file). Now run your app using npm start.
I just randomly experienced this "react-scripts: command not found" error after issuing a react-scripts build request, which was previously working just fine.
A simple reboot of my system corrected the issue.
if anyone is willing to use npm only, then run this npm i react-native-scripts --save, then npm start or whatever the command you use
solution 1:
delete the package-lock.json file and then type -> npm install
solution 2:
/Users/piyushbajpai/.npm/_logs/2019-03-11T11_53_27_970Z-debug.log
like this is my debug path --> so this you will find in the console -> press on command and click on the link, you will find error line;
like this:
verbose stack Error: nest_form#0.1.0 start: react-scripts start
solution 3:
delete the node_module and npm i with fresh way.
solution 4:
go to node_module and delete jses folder and delete it, then do npm i and again start with npm start
I had issues with latest version of yarn 1.15.1-1
I've fixed it by downgrading to lower version sudo apt-get install yarn=1.12.3-1
I ran into this error after renaming the directory with the #/ symbol on macOS to match the name of my NPM package namespace.
When the NPM command looked for installed packages in my local node_modules, it couldn't find it due to the way macOS was rewriting the directory path. After renaming the directory without #/ I was up and running again.
Just You have to restore packages to solve this issue,
So just run command :
npm install or yarn install
I tried every answer but cleaning my npm cache worked..
steps:
Clean cache =====> npm cache clean force.
reinstall create-react-app =====> npm install create-react-app.
npm install.
npm start !!!

Missing package "metro" in the project at D:\ReactNative\FirstProject

Missing package "metro" in the project at D:\ReactNative\FirstProject. This usually means react-native is not installed. Please verify that dependencies in package.json include "react-native" and run yarn or npm install.
Error: Missing package "metro" in the project at D:\ReactNative\FirstProject. This usually means react-native is not installed. Please verify that dependencies in package.json include "react-native" and run yarn or npm install.
enter image description here
I had the same issue after installing
react-native-paper
After follow this steps all worked again
Remove node_modules folder.
Install all dependencies again, run npm install. If show any error Remove package-lock.json.
Run npm start again.
Happy coding.
you don't really need to delete node_modules folder.
just update it by typing:
1/ npm : npm install
or
2/ yarn : yarn install
in your terminal. That will update the node_modules folder content as well as creating all missing files without the need to reinstall it from scratch.
I deleted the folder "node_modules" then run "npm install" again. It worked for me.
I had this issue after I installed react-native-svg
Maybe there is some sort of naming conflict is causing this error? Deleting node_modules and running npm install again fixed it for me.
I was getting the same problem, after running 'npm install --global expo-cli' it solved the issue or you can run npm install
I had this issue after installing #react-native-community/hooks
You don't need to delete any node_modules folder.
Installing react-native again solved the problem for me.
npm i react-native
Try Using npm i metro
Worked for me
try to start the project from main folder created by expo init.
i.e opening the project folder directly on you visual studio
It happened to me when you tried install #react-native/bottom-tabs. But I've installed this package with npm, so I removed this package and installed it again with yarn and it fix my problem with no need to remove node_modules.
You are getting this problem based on how you created the program. So, when I created it from the terminal, following this instruction: https://reactnative.dev/docs/environment-setup it worked, but when I tried to create the program inside of the terminal in an existing project, I got the error.
installing expo and expo start working for me.
I experienced the same issue, I'm using expo managed workflow, and cleaning cache has worked for me.
expo r -c is the command I used.

I am trying to run react project through yarn but it is giving me error what should i do now?

i am trying to run react porject through YARN but it is giving error react-scripts.js already exists in file what should i do now
enter image description here
please run command- "npm install" ,it will install react-script dependency.

expected workspace package to exist for \"sane\""

I got the project from the github and want to install the node_modules by using "yarn install".
When I enter the yarn install, the terminal came out the result as shown as the picture. As a reference, my node version is 12.18.0, yarn version 1.22.4, and npm version 6.14.5. May I know is the version not compatible or somethings else problem?
Same issue using lerna.
Assumed it's the yarn version problem.
Under project folder, I tried rolling back yarn version:
yarn policies set-version 1.19.0
// (or 1.18.0)
Yarn polies documentation
Solved for my case: yarn ^3.22.0, node v14.4.0
A quicker solution is to use:
npx yarn#1.19.0 add your-deps-here

'react-scripts' is not recognized as an internal or external command, operable program or batch file

I am learning to react. The version I installed is 16. I installed prop-types via npm after I got an error that 'react-scripts' is not recognized as an internal or external command, operable program or batch file."
It is an error about react-scripts file missing in your node modules directory at the time of installation.
Now, you can add manually this via the command:
npm install react-scripts
I had the same issue, resolved by simply running following command in the project root folder -
npm install react-scripts --save
If none of the above solutions works and you have already installed the "react-scripts" package
using
npm install react-scripts --save
You can try the below solution to run the application.
You should see the following in your package.json file
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
}
The script : "start": "react-scripts start" is linked to the
file : nodemon node_modules/react-scripts/scripts/start.js
which is used to start the project in the development env
Try to start the project directly using the below commands:
node node_modules/react-scripts/scripts/start.js
or if you have nodemon installed then try
nodemon node_modules/react-scripts/scripts/start.js
Hope this helps :)
If it doesn't get resolved even after running
npm install
OR
npm install react-scripts
Run:
node node_modules/react-scripts/scripts/start.js
Or use node js command-line tool and do npm install and npm start
This solved the problem for me
Simply remove node_modules folder and run npm install
I found the community answer, which is perfect solution
I just had this issue and this solution worked just fine.
run:
npm install react-scripts
that should solve it... Enjoy!!!
Just type npm install and after that run npm start. This solved the problem for me.
One of the causes of this issue is corrupted PATH and the only fix I found for that issue was to (re)install NVM and let the installer take control over the installed Node version when it asks to do so and it will fix the PATH for you. In my case that was the fix.
deleting the node_modules folder and the *.lock file then running npm install in the project directory through the terminal worked.
I tried with yarn install and it worked too after removing the mentioned files above.
It's quite common problem.
Do the following steps:-
npm audit The message will be like - 7 vulnerabilities (1 low, 6 high)
You will get the vulnerabilities, and now fix it with
npm audit fix or npm audit fix --force will prompt message like this
removed 4 packages, changed 82 packages, and audited 1623 packages in 7s
found 0 vulnerabilities
Problem Solved,
Happy Hacking
Resolved by running the following command:
yarn add react-scripts
For this error you just have to delete lock file and use command yarn
You just have to install React Script Again.
You just need to run the command npm i react-scripts and then run npm start
this error has happened to me in mern stack, and took around 3h to fix it:
in the end, this issue because the current node version is not the same I was used to creating the project for the first time. I hope this proposition helped someone in the future.
Hello I'm learning the MERN stack as well(wise use of quarantine time right? )
Anyways, I'm using WINDOWS 10, and I have the same error as well.
I tried react-scripts start and react-scripts is not recognized as an internal command
I did a bit of googling and found out that you need to
npm install react-scripts -g <- notice the -g (stands for global? I think? )
I hope this helps :>
Just go to the Terminal and on the directory which you start your server. TYPE npm install react-scripts
you will be good to go
I was trying to use 'nodemon server' then had the same error.
When I tried 'npx nodemon server', it worked.
Try to use 'npx' in front of 'npm'
Instead of writing react-scripts start just write npm start.

Resources