Try yarn build:
➜ small-shopping-cart git:(master) yarn build
yarn run v1.22.11
$ react-scripts build
/bin/sh: react-scripts: command not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
OK, let's install react-scripts:
➜ small-shopping-cart git:(master) npm install -g react-scripts
...
Try yarn build again:
➜ small-shopping-cart git:(master) yarn build
yarn run v1.22.11
$ react-scripts build
Creating an optimized production build...
Failed to compile.
./src/index.js
Cannot find module: 'react'. Make sure this package is installed.
You can install this package by running: yarn add react.
Alright:
➜ small-shopping-cart git:(master) ✗ yarn add react
yarn add v1.22.11
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning " > [email protected]" has incorrect peer dependency "[email protected]".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] 🔨 Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
✨ Done in 39.63s.
Let's build once again:
➜ small-shopping-cart git:(master) ✗ yarn build
yarn run v1.22.11
$ react-scripts build
(node:38104) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at /Users/tomkwong/OpenSource/mami_shop/small-shopping-cart/node_modules/postcss-safe-parser/node_modules/postcss/package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Compiled successfully.
File sizes after gzip:
41.84 KB build/static/js/2.1b012b6f.chunk.js
1.4 KB build/static/js/3.09346f4e.chunk.js
1.36 KB build/static/js/main.b84dca52.chunk.js
1.17 KB build/static/js/runtime-main.e37e6d2e.js
403 B build/static/css/main.6b4bab0c.chunk.css
The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
You may serve it with a static server:
yarn global add serve
serve -s build
Find out more about deployment here:
https://cra.link/deployment
✨ Done in 9.89s.
yarn start now!
➜ small-shopping-cart git:(master) yarn start
Compiled successfully!
You can now view small-shopping-cart in the browser.
Local: http://localhost:3000
On Your Network: http://192.168.86.170:3000
Note that the development build is not optimized.
To create a production build, use yarn build.