NodeJS React + NPM材料用户界面:Npm安装错误无法解析依赖关系树

2ic8powd  于 2022-12-18  发布在  Node.js
关注(0)|答案(1)|浏览(128)

安装materialUI后,我在尝试在使用create-react-app创建的应用程序上运行npm安装时遇到问题。
我已多次尝试删除node_modules & package_lock.json-问题仍然存在。
我可以继续使用--force来安装npm包,但是这并不理想。我想知道这里的问题是什么。
错误:

package.json:

{
  "name": "video-upload",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@babel/core": "7.1.6",
    "@material-ui/core": "^4.12.4",
    "@mui/material": "^5.11.0",
    "@svgr/webpack": "2.4.1",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.4",
    "@types/react": "^18.0.26",
    "@types/react-dom": "^18.0.9",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "9.0.0",
    "babel-jest": "23.6.0",
    "babel-loader": "8.0.4",
    "babel-plugin-named-asset-import": "^0.3.0",
    "babel-preset-react-app": "^7.0.0",
    "bfj": "6.1.1",
    "case-sensitive-paths-webpack-plugin": "2.1.2",
    "chalk": "2.4.1",
    "css-loader": "1.0.0",
    "dotenv": "6.0.0",
    "dotenv-expand": "4.2.0",
    "eslint": "5.6.0",
    "eslint-config-react-app": "^3.0.6",
    "eslint-loader": "2.1.1",
    "eslint-plugin-flowtype": "2.50.1",
    "eslint-plugin-import": "2.14.0",
    "eslint-plugin-jsx-a11y": "6.1.2",
    "eslint-plugin-react": "7.11.1",
    "file-loader": "2.0.0",
    "fork-ts-checker-webpack-plugin-alt": "0.4.14",
    "fs-extra": "7.0.0",
    "html-webpack-plugin": "4.0.0-alpha.2",
    "identity-obj-proxy": "3.0.0",
    "jest": "23.6.0",
    "jest-pnp-resolver": "1.0.1",
    "jest-resolve": "23.6.0",
    "mini-css-extract-plugin": "0.4.3",
    "optimize-css-assets-webpack-plugin": "5.0.1",
    "pnp-webpack-plugin": "1.1.0",
    "postcss-flexbugs-fixes": "4.1.0",
    "postcss-loader": "3.0.0",
    "postcss-preset-env": "6.3.1",
    "postcss-safe-parser": "4.0.1",
    "react": "^18.2.0",
    "react-app-polyfill": "^0.2.0",
    "react-dev-utils": "^7.0.1",
    "react-dom": "^18.2.0",
    "react-router-dom": "^6.4.4",
    "react-scripts": "5.0.0",
    "resolve": "1.8.1",
    "sass-loader": "7.1.0",
    "style-loader": "0.23.0",
    "styled-components": "^5.3.6",
    "terser-webpack-plugin": "1.1.0",
    "typescript": "^4.9.3",
    "url-loader": "1.1.1",
    "web-vitals": "^2.1.4",
    "webpack": "4.19.1",
    "webpack-dev-server": "3.1.14",
    "webpack-manifest-plugin": "2.0.4",
    "workbox-webpack-plugin": "3.6.3"
  },
  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js"
  },
  "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"
    ]
  },
  "devDependencies": {
    "@types/styled-components": "^5.1.26"
  },
  "jest": {
    "collectCoverageFrom": [
      "src/**/*.{js,jsx,ts,tsx}",
      "!src/**/*.d.ts"
    ],
    "resolver": "jest-pnp-resolver",
    "setupFiles": [
      "react-app-polyfill/jsdom"
    ],
    "setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.ts",
    "testMatch": [
      "<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
      "<rootDir>/src/**/?(*.)(spec|test).{js,jsx,ts,tsx}"
    ],
    "testEnvironment": "jsdom",
    "testURL": "http://localhost",
    "transform": {
      "^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
      "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
      "^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
    },
    "transformIgnorePatterns": [
      "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
      "^.+\\.module\\.(css|sass|scss)$"
    ],
    "moduleNameMapper": {
      "^react-native$": "react-native-web",
      "^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
    },
    "moduleFileExtensions": [
      "web.js",
      "js",
      "web.ts",
      "ts",
      "web.tsx",
      "tsx",
      "json",
      "web.jsx",
      "jsx",
      "node"
    ]
  },
  "babel": {
    "presets": [
      "react-app"
    ]
  }
}
eoigrqb6

eoigrqb61#

您的软件包“fe-react-app-video-upload”依赖于react@18.2.0
如果你安装的是版本的MUI,它可能与之不匹配。在我看来,你试图用旧方法安装MUI。更新版本的Material-UI for React,可在@mui/xxx org获得。
现在,如果你真的想要MUI的v4,出于某种原因,你必须强制安装,这是因为v4依赖于旧的React,而我提到的第一个包依赖于React 18.2.0;任何低版本都不行,只有高版本前面有^符号。

相关问题