错误:找不到模块'tap'

时间:2018-01-17 19:34:47

标签: node.js unit-testing testing mocha chai

出现此错误;

> weather-app@1.0.0 test C:\Users\Ofirs\Desktop\n-4-11-chaining
> mocha **/*.test.js

module.js:540
    throw err;
    ^

Error: Cannot find module 'tap'
    at Function.Module._resolveFilename (module.js:538:15)

当试图通过“npm run test-watch”运行mocha时,这是我的package.json文件:

{
"name": "weather-app",
"version": "1.0.0",
"description": "",
"main": "test.js",
"scripts": {
    "test": "mocha **/*.test.js",
    "test-watch": "nodemon --exec \"npm test\""
},
"author": "",
"license": "ISC",
"dependencies": {
    "request": "^2.83.0",
    "yargs": "^4.8.1"
},
"devDependencies": {
    "chai": "^4.1.2",
    "mocha": "^4.1.0",
    "supertest": "^3.0.0"
}
}

请帮我找到问题所在。和平

1 个答案:

答案 0 :(得分:2)

无需帮助解决问题。我刚刚添加了另一个' *'就在" mocha"。

之后