javascript 无法加载在“package.json”中声明的插件“jest”:无法读取未定义的属性(阅读“meta”)

pn9klfpd  于 2023-01-01  发布在  Java
关注(0)|答案(1)|浏览(93)

Here is a screenshot of the error screen
这就是package.json中的内容。

{
  "name": "********",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^12.1.4",
    "@testing-library/user-event": "^13.5.0",
    "firebase": "^9.6.10",
    "moment": "^2.29.2",
    "react": "^18.0.0",
    "react-datepicker": "^4.7.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "5.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ],
    "rules": {
      "react-hooks/exhanstive-deps": "off"
    }
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

除了删除“eslintConfig”之外,还有什么方法可以解决这个问题吗?我看过其他关于这个错误的文章,但无法理解它。

tv6aics1

tv6aics11#

尝试删除node_modules,然后重新安装。
看起来好像缺少了一个基本的依赖关系。

相关问题