Mastering React- Training

Hello,
I am brand new to react. And taking the mastering react course

I start in terminal with “create-react-app training”.
I am getting a message that a template was not created.

Then I enter the folder with “cd training” and type “npm start”
I am getting an error “missing script start”

Can anyone help me? I attached the picture below
Thank you!

1 Like

Hi
Instead of using npm just like in the course, take the habit to use npx instead.

npx create-react-app my-app

This is because unlike npm, npx will create your project with the latest version of CRA if I got it well.
Also CRA creates a sub folder with project name so you must make sure to be in the correct repository (cd command) then do the npm install command.

Regards.

PS: I just see that the message displayed goes in the direction I told. Basically it says npm install -g create-react-app is about to disappear (if not already) at all and you shouldn’t use it. Should you have installed CRA globally, you are invited to uninstall it.

npx create-react-app my-app will not work.

Just run npm i -g create-react-app@latest and start work with it, I saw in the other posts that some students have done the same and still have no problems.

Why would it not work ?
This is even what the official docs mention here.

Also I just did it at the moment.

PS D:\Users\UchiTesting\Desktop> npx create-react-app my-app
Need to install the following packages:
  create-react-app@5.0.1
Ok to proceed? (y) y
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

Creating a new React app in D:\Users\UchiTesting\Desktop\my-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


added 1395 packages in 4m

214 packages are looking for funding
  run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...

added 71 packages in 15s

226 packages are looking for funding
  run `npm fund` for details
Removing template package using npm...


removed 1 package, and audited 1466 packages in 3s

226 packages are looking for funding
  run `npm fund` for details

6 high severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Created git commit.

Success! Created my-app at D:\Users\UchiTesting\Desktop\my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd my-app
  npm start

Happy hacking!
npm notice
npm notice New minor version of npm available! 9.1.1 -> 9.2.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.2.0
npm notice Run npm install -g npm@9.2.0 to update!
npm notice
PS D:\Users\UchiTesting\Desktop>

A npm install and npm start later

It just works and you can start coding.