react-scripts missing after install redux - reactjs

i created react app according steps described here https://www.sitepoint.com/getting-started-react-beginners-guide/
npm i -g create-react-app
create-react-app myapp
yarn start
Everything worked ok, so i tried install redux as it described here
https://redux.js.org/docs/basics/UsageWithReact.html
npm install --save react-redux
I got this message
react-redux#5.0.7
added 3 packages, removed 1061 packages and updated 18 packages in 14.541s
and now when i try
yarn start
i get message
yarn run v1.3.2
$ react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Whats wrong? I don't understand why is react-scripts not working. I thought that --save adds the third-party package to the package's dependencies and have nothing to do with other packages.
Iam thankfull for every advice what i did wrong and how to fix it.
Thanks

Instead of npm install --save react-redux you should install redux package using yarn.
yarn add redux
issue :
You are creating app using yarn package manager and then adding new packages using npm causing to eject the packages installed using yarn.
Because of this react-scripts getting remove throwing the error.

Related

Why can't I start a React project with npx?

I'm going in circles with npx trying to start a new project. Here's what I get:
"PS C:\Users\John\Documents\WebSites\react_projects> npx create-react-app material-ui
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
"You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).
"We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
npm uninstall -g create-react-app
yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
https://create-react-app.dev/docs/getting-started/"
When I type npm uninstall -g create-react-app, I get "up to date, audited 1 package in 495ms. found 0 vulnerabilities."
So I try to create the app again with npx, and I get this:
"Need to install the following packages:
create-react-app
Ok to proceed? (y)"
So I press y, and I get the first error message again. I just go in circles. How can I fix this?
Refer to official reactjs website you need to have ""Node >= 14.0.0 and npm >= 5.6"" on your machine. https://reactjs.org/docs/create-a-new-react-app.html .
Also yarn create is available in Yarn 0.25+
so you might want to check these versions
npm
stands for node package manager. It helps to install, migrate apps by adding dependencies in package.json file. You only need to run npm i. For example in react API call npm i axios you should run and import in file in order to use axios features. Also all you need to have is package.json following dependencies and packages will be added(except node_modules folder as it comes with packages and more in size).
You can use npm to start, build, eject, watch and test.
npx is a CLI tool which provide way to install and manage dependencies hosted in npm registry. It is bundled with npm since 5.2.0v. It is helpful in installing and getting started with frontend JS libraries like reactjs, angularjs, vuejs, Sveltejs or boilerplate apps.

How can i solve "No project found" error when installing react

I am new to react and i am taking my first course on openclassrooms on react.
The instructor is using the command
yarn global add create-react-app
to setup but when i run the commdand i get the error below
Usage Error: No project found in /E:/Web Dev/React/react-project
i have tried to use the command below that is provided in the react documentation but i stil get the same error
yarn create react-app my-app
How can i solve the problem i have looked up on the react documentation but still cannot find the solution.
I experienced the same issue and solved it as follows:
Uninstall yarn from npm using npm uninstall -g yarn
Install Yarn from Installation - Yarn Classic
Restart PowerShell / CMD
Before performing the above steps yarn --version printed 2.0.0-rc.27 on my machine. Now it prints 1.22.4.
Having Yarn 2.x globally installed is discouraged accourding to Installation - Yarn 2.x.

Creating a react App starts aborting installation

While creating a new react app, getting this error.
Aborting installation. yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\.... \my-app has failed.
I know #5328 gave solution by removing . npmrc file here - https://github.com/facebook/create-react-app/issues/5328#issuecomment-429148117
I am new to react .. so can some one please let me know how do I find .npmrc file and how do i remove it? Or how do I create a new react app without having this error?
I know we can create a react app with the following command:
npx create-react-app my-app
or
yarn create react-app my-app
or
npm init react-app my-app
Thanks!
Okay,
I solved this problem by following the below steps:
npm install -g npm#latest
npm install node
npm install -g yarn
yarn cache clean
npx create-react-app my-app
I faced the same issue while creating a new app with CRA.
I tried all the below-mentioned solution:
1) Uninstall Yarn and install again.
2) yarn cache clean
3) npm uninstall -g create-react-app and install again.
Here's main issue:
error #typescript-eslint/eslint-plugin#2.13.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.11.0"
error Found incompatible module.
You may have got something similar. Look a couple of lines above "Aborting installation"
In my case, I was using Node version "10.11.0". I install a stable version of Node and it worked absolutely fine.
To double-check I tried to simulate the issue by changing the version with the help of NVM, and got the same issue.
Please refer to the error message and you'll figure out the culprit.
Note: I would still suggest keeping the updated and stable version of Yarn and CRA.

How can i correct the error i keep getting in creating a react app

Each time i tried creating a react app using create-react-app <...name> i keep getting this error "
Creating a new React app in C:\windows\system32\brian-todos.
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 '...tXcMskoaoOolrubJ3NQGh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BrianMartinez\AppData\Roaming\npm-cache_logs\2019-01-12T13_11_25_580Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting brian-todos / from C:\windows\system32
Done."
I even tried npm clear cache it still didn't not work.What do i do about this challenge
It seems you opened your windows console or powershell as an administrator, and you landed in system32 folder. Don't create your project there, that is a reserved folder for system executables. Do something like cd C:\Users\yourusername\Documents and try there.
This is the answer to the challenge i had before now. follow these steps
npm install -g yarn
yarn global add create-react-app
create-react-app

npm start not working after create-react-app

I am trying to create a react app with the below steps:
npm install -g create-react-app
create-react-app my-app
cd my-app
npm start
And I get this error:
In error have suggestion to remove webpack dependency but i cant do that because in file package.json dun have that. Here my package.json
For additional information:
i am using windows 10
npm 6.4.1
create-react-app version 2.0.3
node v8.12.0
Just do following steps:
- delete package-lock.json.
- delete node_modules.
- npm install.
Or
Just try steps mentioned in the error log and you will be fine .
Do step number 6 and delete that babel loader or webpack folder and you will be good afterwards. Chances are you have an outdated web pack or babel that you installed in a previous project.
I just had this very issue, and turns out to be something simple
The part of the log that says about there being a
"a different version of webpack was detected higher up in the tree"
looks to be the same case for you. I think you may have ran npm install at some point under D:\bolehDiHapus and so have node_modules installed further up the tree that you meant.
I simply changed the name of D:\bolehDiHapus\node_modules (probably best to just delete it) and hey presto npm start works.
I had this same issue, first it started saying we found the wrong version farther up in the tree, and then i had to delete webpack up there, and then i had install their "required version" even if it is lower than latest.
npm install webpack#version --save
in your case: npm install --save webpack#4.19.1

Resources