I'm having some trouble with react-scripts after creating a new react project.
I created/initialised the project using npx create-react-app dashboard
.
After going inside the dashboard folder and running npm start
(without doing anything else beforehand), I get the following error:
>npm start
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> dashboard@0.1.0 start
> react-scripts start
'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
I have checked the package.json file and it does have react-scripts listed (v5.0.1, full package.json below) and checking the node_modules folder shows a react-scripts folder there and react-scripts files (cmd, ps1 and 1 with no extension) inside the .bin folder too.
I've tried clearing the npm cache (npm cache clean -f
), installing things again (deleting package-lock.json and node_modules folder then running npm install
) and nothing seems to change.
I've also tried running npm start
in command prompt, powershell and powershell as an admin. I've also tried restarting my PC and retrying too without any luck.
Specs:
Edition: Windows 10 Pro
Version: 21H2
OS build: 19044.1766
Experience Windows Feature Experience Pack: 120.2212.4180.0
Node JS version: 16.15.1
npm version: 8.11.0
full package.json:
{
"name": "dashboard",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
If anyone has any ideas on how to fix this, I'd appreciate the help. Let me know if you need/want any more info that might help debug this issue