jrz
jrz

Reputation: 1387

Cannot manage to install jest

I am using npm to install jest in order to perform some tests over my js code. In order to install it I use the command:

$ npm install --save-dev jest

As described on their website.

However, it fails over and over again with these errors: enter image description here

What should I do in order to install jest properly?

This is my 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"
}

Current message: enter image description here

Upvotes: 1

Views: 3331

Answers (2)

X.Hal
X.Hal

Reputation: 13

I simply deleted the node_modules and package-lock.json, and use yarn to re-install everything. And it worked...

Upvotes: 0

Sakhi Mansoor
Sakhi Mansoor

Reputation: 8102

Please install react v16 for this:

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

then run this command:

npm update --save

to get all dependent packages

Upvotes: 1

Related Questions