反应脚本的问题.不启动应用程序.(问题)的依赖



我的应用程序工作很好,直到我更新了反应脚本。更新后,每次我尝试运行应用程序时都会显示此错误。项目依赖树可能有问题。这可能不是Create React App中的bug,而是需要在本地修复的bug。

Create React App提供的React -scripts包需要依赖项:

"babel-jest"^ 26.6.0"

不要尝试手动安装:你的包管理器会自动安装。然而,在树的更高位置检测到一个不同版本的babel-jest:

C:UsersDigital DividendDesktopAccurator Accurator node_modulesbabel-jest (version: 27.2.5)

手动安装不兼容的版本会导致难以调试的问题。

如果您希望忽略此检查,请将SKIP_PREFLIGHT_CHECK=true添加到项目中的.env文件中。这将永久禁用此消息,但您可能会遇到其他问题。

要修复依赖树,请尝试按照下面的顺序执行步骤:

  1. 删除package-lock。Json(不是package.json!)和/或yarn. Json。
  2. 删除项目文件夹中的node_modules。
  3. 删除"babel-jest"从包中的dependencies和/或devDependencies中获取。
  4. 运行npm install或yarn,这取决于你使用的包管理器。

在大多数情况下,这应该足以解决问题。如果这没有帮助,您可以尝试其他一些方法:

  1. 如果你使用的是npm,请安装yarn (http://yarnpkg.com/)并重复上面的步骤。这可能会有所帮助,因为npm在包提升方面有一些已知的问题,这些问题可能会在未来的版本中得到解决。

  2. 检查C:UsersDigital DividendDesktopAccurator Accurator node_modulesbabel-jest是否在你的项目目录之外。例如,您可能不小心在主文件夹中安装了一些东西。

  3. 尝试在你的项目文件夹中运行npm ls babel-jest。这将告诉您安装babel-jest的其他包(除了预期的react-scripts)。

如果没有其他帮助,将SKIP_PREFLIGHT_CHECK=true添加到项目中的.env文件中。如果你想继续飞行,这将永久禁用飞行前检查。

"name": "accurator-web",
"version": "0.1.0",
"private": true,
"dependencies": {
"@latticehr/react-org-chart": "^0.1.1",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"animejs": "^3.2.1",
"axios": "^0.23.0",
"azure-storage": "^2.10.5",
"canvg": "^3.0.9",
"datatables.net": "^1.11.3",
"dotenv": "^10.0.0",
"draft-js": "^0.11.7",
"draftjs-to-html": "^0.9.1",
"fbemitter": "^3.0.0",
"floatthead": "^2.2.4",
"fontawesome-markers": "^4.6.1",
"formik": "^2.2.9",
"getstream": "^7.2.11",
"google-translate-api": "2.3.0",
"html-to-draftjs": "^1.5.0",
"immutability-helper": "^3.1.1",
"jquery": "3.3.1",
"js-file-download": "^0.4.12",
"lodash": "^4.17.21",
"material-table": "^1.69.3",
"moment": "^2.29.1",
"nprogress": "^0.2.0",
"query-string": "^7.0.1",
"react": "^16.13.1",
"react-autosuggest": "^10.1.0",
"react-avatar": "^3.10.0",
"react-bootstrap": "^1.6.4",
"react-datepicker": "^4.2.1",
"react-dom": "^16.13.1",
"react-draft-wysiwyg": "1.14.1",
"react-file-drop": "^3.1.2",
"react-ga": "2.5.3",
"react-html-parser": "2.0.2",
"react-intl": "^5.20.13",
"react-loading": "^2.0.3",
"react-moment": "^1.1.1",
"react-notifications": "^1.7.2",
"react-rating": "^2.0.5",
"react-rating-stars-component": "^2.2.0",
"react-router-dom": "4.3.1",
"react-scripts": "^4.0.3",
"react-select": "^5.1.0",
"react-star-ratings": "^2.3.0",
"react-stepzilla": "^7.0.0",
"react-toggle": "^4.1.2",
"react-tooltip": "^4.2.21",
"react-widgets": "^5.4.0",
"react-widgets-moment": "^5.0.9",
"rxjs": "^7.4.0",
"socket.io-client": "^4.3.2",
"typescript": "^4.4.4",
"unstated": "^2.1.1",
"yup": "^0.32.11"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"extract:messages": "react-intl-cra 'src/**/*.js' -o 'output/messages.json'"
},
"proxy": "http://localhost:4000",
"devDependencies": {
"globby": "8.0.1",
"react-intl-cra": "0.3.3"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
请帮帮我,我已经在这上面浪费了4个小时了。我已经按照上面的步骤做了很多次了

尝试删除你的node_modules和你的。lock文件,然后做一个yarn/npm安装之后

你可能还需要将"babel-jest": "^26.6.0"替换为"babel-jest": "27.3.1"并运行npm/yarn install

相关内容

  • 没有找到相关文章

最新更新