我正在使用npm
安装jest
以便对我的js代码进行一些测试。
为了安装它,我使用命令:
$ npm install --save-dev jest
如其网站上所述。
我该怎么做才能正确安装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"
}
答案 0 :(得分:1)
请为此安装react v16:
npm install --save react@^16.4.2 react-dom@^16.4.2
然后运行以下命令:
npm update --save
获取所有依赖包
答案 1 :(得分:0)
我只是删除了node_modules和package-lock.json,并使用yarn重新安装了所有内容。而且有效...