Remember to navigate to the desired folder then:
- Install npm in the project directory:
npm install - Create the folder:
npx create-react-app@latest PREFERRED-DIRECTORY-NAME - once the dependencies are installed run:
npm startornpx react-scripts start
- Navigate to the desired folder.
- Initialize a new npm project:
npm init -y - Install the necessary React dependencies:
npm install react react-dom react-scriptsor if that does not work, trynpm install react react-dom react-scripts @babel/core @babel/preset-react --save - Remember to add or ensure the required scripts are in the package.json of the current directory:
{
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
}
- Remember to add these additional required fields to your package.json:
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
- Create required files and folders for a React app if not already present.
- After setting these up, try running:
npm start
Don't want to enroll in the course, but still find the Content Useful?
You can always buy me a coffee and/or "star" this repo