Sometimes, we may encounter the “‘react-scripts’ is not recognized as an internal or external command” error when we try to run our React project.
In this article, we’ll look at how to fix the “‘react-scripts’ is not recognized as an internal or external command” error when we try to run our React project.
Install the react-scripts NPM Package
One way to fix the “‘react-scripts’ is not recognized as an internal or external command” error is to install the react-scripts package.
To do this, we run:
Reinstall all NPM Packages
Another way to fix this error is to reinstall all packages.
To do this, we run:
rm -rf node_modules && npm installon Linux or macOS or:
rm /s /q node_modules && npm installon Windows.
We can also run:
to reinstall all packages.
Reinstall npm audit fix
The npm audit fix command will install any packages that are missing in node_modules but it’s present in package.json .
Reinstall npm update
npm update will update any packages that are present in the project.
So we can run this to reinstall any packages that are missing.
Conclusion
One way to fix the “‘react-scripts’ is not recognized as an internal or external command” error is to install the react-scripts package.
Another way to fix this error is to reinstall all packages.
npm audit fix or npm update will also help reinstall missing packages.
{ "name": "WeatherApp", "version": "0.1.0", "private": true, "devDependencies": { "autoprefixer": "6.5.1", "babel-core": "6.17.0", "babel-eslint": "7.1.1", "babel-jest": "17.0.2", "babel-loader": "6.2.7", "babel-preset-react-app": "^2.0.1", "case-sensitive-paths-webpack-plugin": "1.1.4", "chalk": "1.1.3", "connect-history-api-fallback": "1.3.0", "cross-spawn": "4.0.2", "css-loader": "0.26.0", "detect-port": "1.0.1", "dotenv": "2.0.0", "eslint": "3.8.1", "eslint-config-react-app": "^0.5.0", "eslint-loader": "1.6.0", "eslint-plugin-flowtype": "2.21.0", "eslint-plugin-import": "2.0.1", "eslint-plugin-jsx-a11y": "2.2.3", "eslint-plugin-react": "6.4.1", "extract-text-webpack-plugin": "1.0.1", "file-loader": "0.9.0", "filesize": "3.3.0", "fs-extra": "0.30.0", "gzip-size": "3.0.0", "html-webpack-plugin": "2.24.0", "http-proxy-middleware": "0.17.2", "jest": "17.0.2", "json-loader": "0.5.4", "node-sass": "^4.5.0", "npm-run-all": "^4.0.2", "object-assign": "4.1.0", "path-exists": "2.1.0", "postcss-loader": "1.0.0", "promise": "7.1.1", "react-dev-utils": "^0.4.2", "recursive-readdir": "2.1.0", "strip-ansi": "3.0.1", "style-loader": "0.13.1", "url-loader": "0.5.7", "webpack": "1.14.0", "webpack-dev-server": "1.16.2", "webpack-manifest-plugin": "1.1.0", "whatwg-fetch": "1.0.0" }, "dependencies": { "react": "^15.4.2", "react-dom": "^15.4.2", "react-redux": "^5.0.2", "redux": "^3.6.0", "redux-logger": "^2.8.1", "redux-promise-middleware": "^4.2.0", "redux-thunk": "^2.2.0" }, "scripts": { "build-css": "node-sass src/ -o src/", "watch-css": "npm run build-css && node-sass src/ -o src/ --watch --recursive", "start-js": "react-scripts start", "start": "npm-run-all -p watch-css start-js", "build": "npm run build-css && react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, "jest": { "collectCoverageFrom": [ "src/**/*.{js,jsx}" ], "setupFiles": [ "<rootDir>\\config\\polyfills.js" ], "testPathIgnorePatterns": [ "<rootDir>[/\\\\](build|docs|node_modules)[/\\\\]" ], "testEnvironment": "node", "testURL": "//localhost", "transform": { "^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest", "^.+\\.css$": "<rootDir>\\config\\jest\\cssTransform.js", "^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>\\config\\jest\\fileTransform.js" }, "transformIgnorePatterns": [ "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$" ], "moduleNameMapper": { "^react-native$": "react-native-web" } }, "babel": { "presets": [ "react-app" ] }, "eslintConfig": { "extends": "react-app" } }