【发布时间】:2020-08-03 17:58:30
【问题描述】:
我正在使用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"
}
【问题讨论】:
-
看起来与开玩笑或反应无关,我会尝试
rn -rf node_modules(或 Win 等效项)并可能清除 npm 缓存npm cache clean --force并重试。
标签: javascript reactjs npm jestjs npm-install