繁体   English   中英

Create React App 提供的 react-scripts package 需要依赖

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

我正在使用 Volt react 仪表板。 每次我在终端中运行 yarn install 时,都会收到以下错误消息:

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.

我尝试按照上面概述的说明进行操作,但没有成功,我尝试创建一个 .env 文件并具有以下内容:SKIP_PREFLIGHT_CHECK=true

但仍然。

这是我的 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"
  ]
 }

}

这个问题的可能解决方案是什么?

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-应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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