react-scripts is not recognize - node.js

I have problem about react project when I hit enter the command like yarn start so I have face the mentioned problem like react-script is not recognize internal or external command. I have this script in dependencies but still I face this problem.
I have the latest version of node, and I have updated npm but still I have this problem.

Try this command: npm add react-scripts --include=dev

Make sure that you are inside the project folder before you use the yarn start command.
Or try deleting the cache and node-modules and package-lock.json and re-install it.
You can try manually installing react-scripts for your application.

1 . Try yarn install
2 . If the problem is not solved yarn add react-scripts --dev

Related

nodejs conflicting with vue native router

nodejs version 14.17.5
vue native version 0.3.0
I am developing an application that requires navigation in APP.
When i give command "npm run start" the application successfully runs.
Package.json dependencies installed:
enter image description here
For navigation when i run command "npm install view-native-router" it shows the error message as below:
enter image description here
Does anybody have the idea what could possibly have gone wrong? Is it a compatibility issue ?
It seems this is not the first time we have a peer dependency problem here and the last issue was marked as solved.
https://github.com/GeekyAnts/vue-native-router/issues/45
Since you have a higher version of vue-native-core in local, try add --legacy-peer-deps to npm install to see if works.
Though --force or --legacy-peer-deps may work for some but not everyone.
My solution is to start using yarn! Install it by the following:
$ npm i -g yarn
After its installed, its advised that you delete the project and redo the vue-native-cli init command so it can use yarn from there, but you can also just directly use the following command without deleting the project:
$ yarn install vue-native-scripts

Create a React app with express, 'react-scripts' error

I have been following this webpage: https://medium.com/walmartglobaltech/creating-react-redux-express-full-stack-application-part-i-82959d847802
So the first time I ran into some issues so I thought it would be best to start from scratch.The first time I kept getting errors about 'react-scripts' is not recognized. I tried 'npm install react-scripts --save' but that didn't work so I gave up and deleted that project.
But when I made the new one it highlighted a bunch of stuff as wrong. And when I got to 'npm start' it keeps saying, 'react-scripts' is not recognized as an internal or external command. My friend did this and she didn't run into this error. I am new to Node.js anything would be helpful!
things that I've tried that didn't work:
npm install -f
rm -rf node_modules && npm install
npm install --save react-scripts
npm cache clean --force
npm rebuild
npm install
I created a new workspace and it inherited the error- is there a way to delete it all and try again?
-Please help
You can try using yarn. There have been some who solved it this way. I hope you can solve your problem.
yarn add react-scripts
So there were two issues: first my directory needed to be updated and I didn't have the node_modules in my client folder - hope this helps anyone else!
I had similar problem, but I restarted the system and it worked. Don't know exactly what was causing this issue might be a cache issue.

react-scripts required old version of webpack

I installed webpack into my react project, but the same error occurred every time when I use npm start:
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.42.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
C:\react\minimoj\node_modules\webpack (version: 4.43.0)
I tried to remove package-loc.json file + all node_modules + remove webpack name from package.json and reinstall it with npm install. Also I tried same with yarn, but it didn't help. I see that in node_modules version is 4.43 and after I use npm install webpack in the file package-loc.json it shows 4.43, but at the moment when I use npm start it changed to 4.42 and error occur. In addition I also reinstall node.js but it didn't help.
create .env file and add SKIP_PREFLIGHT_CHECK=true
I had similar with a newer webpack version being installed than what react_scripts required.
To fix I deleted webpack and webpack-dev-server from my project's node_modules, went to a console outside of the project dir and ran
npm uninstall webpack
npm uninstall webpack-dev-server
Then ran
npm install
npm run build
And all was well, as my package.json was correct without change.
Since webpack is mostly focused on common js according to some websites, I just tried rollup for my react project and it proved to be much more effective as it supports es+. I would highly recommend it. I took a couple minutes to have everything setup and ready. Also, as a good practice it is better to use yarn as npm has had a lot of known issues for node app management.

unable to create a new project with create-react-app

I've just finished installing create-react-app successfully.
But, when I create a new project like below command, error happens.
Could you please give me a recommandation?
system env.:
- aws lightsail 1vcpu, 0.5G ram / ubuntu 18.04
- nodejs version : 13.9.0
- npm version : 6.13.7
- create-react-app version : 3.4.0
~$ npm create-react-app my-app
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
core-js#2.6.11 postinstall /home/ubuntu/my-app/node_modules/babel-runtime/node_modules/core-js
node -e "try{require('./postinstall')}catch(e){}"
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Done.
Switch to Yarn
It was a raised issue on github a couple of years back..
it was solved after switching to yarn.
These commands could not solve the issue.
npm cache clean --force
create-react-app my-apps
Switching to Yarn worked!
npm install -g yarn
yarn global add create-react-app
create-react-app my-app
See if this helps!
This error is due to the fact that a dependant module named core-js is trying to run a post-install script. This post-install script spawns a child process and runs a shell script there. For some reason Node sets/assumes a wrong bash path by default. I had to manually change the path by running the following command.
npm config set script-shell $(which sh)
Note: For Windows you might have to setup your own bash.exe by installing something like git-bash and then you could assign the path similarly.
Try this: npm cache clean --force

create-react-app command aborting installation Why?

windows 10
node v10.15.1
npm v6.8.0;
I:\>npx create-react-app newpomodoro
Creating a new React app in I:\newpomodoro.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...:"^2.2.x","topo":"1.x'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-03-03T17_21_57_703Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting newpomodoro/ from I:\
Done.
I installed react globaly and loacaly as well but still it was giving me same error.
Can anyBody tell me whats going wrong.
Use this command:
npm cache clean --force
I am having this same problem with npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. Mine then deletes node_modules and package.json. I have asked about this here: NPX create-react-app aborting installation after vulnerabilities found
I have already tried to use npm cache clean --force but this has not solved the problem. I have also tried installing different versions of node.js to no avail.
I ran into a similar issue. I don't know if you might have been in the same boat, but the cause was a space in my path name. I often save my projects on google file stream which has a space in the name ("G:/My Drive/..."). I tried creating the app in another directory and moving the folder which ended up working out.
The command npm clean --cache won't help.
If you are facing an abort installation error in react.
The abort installation error generated because of the older node version.
you should update your node package version.
To solve, run the following command and it will solve the abort installation error.
nvm install node 12.18.0
So, update your node package to the latest one. Once you've updated your node package then create your react app as follows:
npx create-react-app <your-app-name>
The abort installation error occurred because the outdated version of your node was not supporting the create-react-app command and deleted the node_modules and package.json file
Try this, please. It solved my error and hopefully, it'll solve your error too.
The issue was in node version just update it to latest version and it work's for me!
https://nodejs.org/en/download/
here is the solution which works for me, first of all, you should update all of your dependencies
then ran the command
npm cache clean --force
after that you can use
npx create-react-app

Resources