我运行 Mocha 测试
但出现错误
Error: Cannot find module 'expect.js'
我的package.json
{
"name": "new-restexpress",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"start": "node index.js",
"test": "PORT=3007 ./node_modules/.bin/mocha test -R spec"
},
"author": "Richard Rublev",
"license": "ISC",
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.3",
"expect": "^25.3.0",
"mocha": "^7.1.1",
"prettier": "^2.0.4",
"standard": "^14.3.3",
"superagent": "^5.2.2"
},
"dependencies": {
"body-parser": "^1.19.0",
"express": "^4.17.1",
"mongodb": "^2.2.36",
"mongoskin": "^2.1.0",
"morgan": "^1.10.0"
}
}
我用tree -d 看了
│ ├── expect
│ │ ├── build
│ │ │ └── ts3.4
│ │ ├── build-es5
│ │ └── node_modules
│ │ ├── ansi-styles
│ │ ├── color-convert
│ │ └── color-name
为什么expect不被识别?
最佳答案
关于javascript - 为什么 Mocha 找不到模块?找不到模块 'expect.js',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61290523/