简体   繁体   中英

The react-scripts package provided by Create React App requires a dependency

I am using the Volt react dashboard. every time I run yarn install in the terminal, I get the following error message:

yarn run v1.22.10
warning ..\..\..\..\package.json: No license field
$ react-scripts start

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.

The react-scripts package provided by Create React App requires a dependency:

"babel-jest": "^24.9.0"

Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-jest was detected higher up in the tree:

C:\Users\alhus\Desktop\Accounting Cloud Project\Volt Dashboard\volt-react- 
dashboard\node_modules\babel-jest (version: 26.6.3)

Manually installing incompatible versions is known to cause hard-to-debug issues.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your 
project.
That will permanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exact order:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your 
     project folder.
  4. Run npm install or yarn, depending on the package manager you use.

 In most cases, this should be enough to fix the problem.
 If this has not helped, there are a few other things you can try:

  5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
     This may help because npm has known issues with package hoisting which may get resolved in 
     future versions.

  6. Check if C:\Users\project\volt-react-dashboard\node_modules\babel-jest is outside your project 
     directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls babel-jest in your project folder.
     This will tell you which other package (apart from the expected react-scripts) installed babel- 
     jest.

 If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
 That would permanently disable this preflight check in case you want to proceed anyway.

 P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

 error Command failed with exit code 1.
 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried following the instructions outlined above, but it did not work, I tried creating a.env file and having the following: SKIP_PREFLIGHT_CHECK=true

but still.

Here is my package.json:

{
  "name": "@themesberg/volt-react-dashboard",
  "description": "Volt React Dashboard is a free and open source admin dashboard template powered by 
  React.js and Bootstrap 5",
  "author": "abc",
  "keywords": [
  "bootstrap 5",
   "react",
   "react dashboard",
   "react admin template",
   "free react",
   "react ui library",
   "react bootstrap 5",
   "bootstrap 5 dashboard",
   "themesberg"
  ],
  "license": "MIT",
  "homepage": "https://demo.themesberg.com/volt-react-dashboard",
  "bugs": {
  "url": "https://github.com/themesberg/volt-react-dashboard/issues"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/themesberg/volt-react-dashboard"
  },
  "version": "1.0.0",
  "dependencies": {
    "@fortawesome/fontawesome-free": "^5.15.1",
    "@fortawesome/fontawesome-svg-core": "^1.2.30",
    "@fortawesome/free-brands-svg-icons": "^5.14.0",
    "@fortawesome/free-regular-svg-icons": "^5.14.0",
    "@fortawesome/free-solid-svg-icons": "^5.14.0",
    "@fortawesome/react-fontawesome": "^0.1.11",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.3.2",
    "@testing-library/user-event": "^7.1.2",
    "@themesberg/react-bootstrap": "^1.4.1",
    "bootstrap": "5.0.0-beta1",
    "chartist": "^0.11.4",
    "chartist-plugin-tooltips-updated": "^0.1.4",
    "moment-timezone": "^0.5.31",
    "node-sass": "^4.14.1",
    "react": "^16.13.1",
    "react-chartist": "^0.14.3",
    "react-copy-to-clipboard": "^5.0.3",
    "react-datetime": "^3.0.4",
    "react-dom": "^16.13.1",
    "react-github-btn": "^1.2.0",
    "react-live": "^2.2.3",
    "react-router-dom": "^5.2.0",
    "react-router-hash-link": "^2.3.1",
    "react-scripts": "3.4.3",
    "react-transition-group": "^4.4.1",
    "simplebar-react": "^2.3.0",
    "babel-jest": "^24.9.0"
   },
   "scripts": {
     "start": "react-scripts start",
     "build": "react-scripts build",
     "build-local": "PUBLIC_URL=./ react-scripts build",
   "test": "react-scripts test",
   "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
     ">0.2%",
     "not dead",
     "not op_mini all"
  ],
  "development": [
    "last 1 chrome version",
    "last 1 firefox version",
    "last 1 safari version"
  ]
 }

}

What might be a possible solution to this problem?

if you still have The react-scripts package provided by Create React App requires a dependency: npm uninstall -g create-react-app && npm i -g npm@latest && npm cache clean -f and then create your npx create-react-app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM