无法管理安装jest

问题描述 投票:0回答:1

我正在使用npm来安装jest,以便对我的js代码执行一些测试。为了安装它,我使用命令:

$ npm install --save-dev jest

如他们网站上所述。

然而,它一遍又一遍地失败了这些错误:enter image description here

我该怎么做才能正确安装jest

这是我的package.json:

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "babel-preset-env": "^1.7.0",
    "jest": "^23.5.0",
    "react-scripts": "0.6.1"
  },
  "dependencies": {
    "adal-angular": "^1.0.13",
    "axios": "^0.15.3",
    "bootstrap": "^3.3.7",
    "jquery": "^3.1.1",
    "lodash": "^4.16.4",
    "react": "^15.4.2",
    "react-bootstrap": "^0.30.5",
    "react-bootstrap-typeahead": "^1.2.0",
    "react-dom": "^15.4.2",
    "react-http-request": "^1.0.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "description": "This project was bootstrapped with [Create React App] 
  (https://github.com/facebookincubator/create-react-app).",
  "main": "index.js",
  "author": "",
  "license": "ISC"
}

当前消息:enter image description here

javascript reactjs npm jestjs npm-install
1个回答
1
投票

请为此安装react v16:

npm install --save react@^16.4.2 react-dom@^16.4.2

然后运行此命令:

npm update --save

获得所有依赖包

© www.soinside.com 2019 - 2024. All rights reserved.