React Router Lesson - npm start not working

Hello,

I am doing the React Router lesson (https://www.codecademy.com/paths/full-stack-engineer-career-path/tracks/fscp-22-react-part-ii/modules/wdcp-22-react-router/lessons/intermediate-react-react-router/exercises/what-is-routing)

I was able to follow the steps all the way up to starting the live React app. So, I did npm install, installed [email protected] , and imported BrowserRouter from react-router-dom and rename it to Router .

However, I am running into an issue when trying to start the React app locally using ‘npm start’

Blockquote
npm ERR! Missing script: “start”
npm ERR!
npm ERR! Did you mean one of these?
npm ERR! npm star # Mark your favorite packages
npm ERR! npm stars # View packages marked as favorites
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
Blockquote

I have npm version 8.19.2

My package.json has “start”: “react-scripts start” so I’m unsure what’s going on?

I even tried to replace that line with “start”: “react-scripts --openssl-legacy-provider start” as I saw in another post, but I’m receiving the same error.

Hi,
I had the same problem and found that the issue was that I was trying to start React while on the react-router-lesson-starter-1 directory, so npm was reading the package.json file in the first folder. When I switched to the react-router-lesson-starter folder inside the react-router-lesson-starter-1 folder and then tried to start React, the start was successful as it was reading the package.json that actually contains the start script. But the rendering was unsuccessful as I probably installed the newer version of React Router. Hope this helps :slightly_smiling_face:

2 Likes