[React, scaffolding and yarn] Expose webpack rules and report an error: error Command failed with exit code 1.

Table of contents

question

  1. Because all unnecessary files are deleted when the project is initialized, only the files shown in the figure are left (node_modules is not moved, only two files are left under public: index.html and favicon.ico, and only one file is left under src: index. js).
    insert image description here
  2. Execution: yarn ejectThe following problems will occur.
cengguilideMacBook-Pro:myapp zengguili$ yarn eject
yarn run v1.22.19
$ react-scripts eject
NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html

✔ Are you sure you want to eject? This action is permanent. … yes
This git repository has untracked files or uncommitted changes:

README.md
D public/logo192.png
D public/logo512.png
D public/manifest.json
D public/robots.txt
D src/App.css
D src/App.js
D src/App.test.js
D src/index.css
M src/index.js
D src/logo.svg
D src/reportWebVitals.js
D src/setupTests.js

Remove untracked files, stash or commit any changes, and try again.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

solution

  1. Enter the terminal command:
git add -A
git commit -m'init'
  1. Select y to execute.
  2. Execute the command again: yarn ejectthe webpack rules can be exposed.

Guess you like

Origin blog.csdn.net/qiqizgl777/article/details/129505483