Docker class 3. Sample Web Application React build error

I am stuck and cannot proceed with the Docker lesson.

When I follow the exercise in the Docker course, Building Images, 3. Sample Web Appication,
I follow the instruction to download the zip file with a simple react application and type

Mac OS Big Sur

node --version
v16.13.2

npm --version
8.1.2

npm install

The installation result in a number of warnings and errors.
added 1961 packages, and audited 1962 packages in 2m

80 packages are looking for funding

run npm fund for details

74 vulnerabilities (12 low, 22 moderate, 37 high, 3 critical)

To address issues that do not require attention, run:

npm audit fix

To address all issues (including breaking changes), run:

npm audit fix --force

Run npm audit for details.

When I follow the next step to start the react application

npm start

I got these messages

Failed to compile.

./src/App.js
Line 6: ‘React’ must be in scope when using JSX react/react-in-jsx-scope
Line 7: ‘React’ must be in scope when using JSX react/react-in-jsx-scope
Line 8: ‘React’ must be in scope when using JSX react/react-in-jsx-scope
Line 9: ‘React’ must be in scope when using JSX react/react-in-jsx-scope
Line 10: ‘React’ must be in scope when using JSX react/react-in-jsx-scope
Line 12: ‘React’ must be in scope when using JSX react/react-in-jsx-scope

Search for the keywords to learn more about each error.

Please advise.

KK

Hello

I did some search on the error
‘React’ must be in scope when using JSX react/react-in-jsx-scope

and find that the source code App.js

Need to add the following line

import * as React from ‘react’;

Once added, the React app started properly.

1 Like