In my package.json
I have the following scripts block:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
I understand that when we type npm start
or npm run start
it executes the command listed in the scripts block under start
.
When I type npm start
it starts my React app.
Why is it then when I type react-scripts start
, that it says:
bash: react-scripts: command not found
If you globally installed react-scripts
you can run it.
npm install -g react-scripts
But in your setup, it is under node modules. So, only npm can run it.
If you dont prefer to install react-scripts
globally, you can go to the project / repository directory containing .node_modules
and then run:
node ./node_modules/.bin/react-scripts start
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.