【发布时间】:2018-11-19 20:51:41
【问题描述】:
我在理解节点如何解析本地 node_modules 文件夹中的模块时遇到问题。我的应用程序使用了一个名为http-errors 的模块,它是node_modules 中的一个依赖项。我使用了一个Powershell命令来确认它
❯ npm ls --prod | Select-String -Pattern "http-errors"
| | +-- http-errors@1.6.3
| | | +-- http-errors@1.6.2
| | +-- http-errors@1.6.3
为什么找不到http-errors模块还是报错?
添加:这是我需要http-errors的地方
const createError = require('http-errors');
function catchNotFound(_req, _res, next) {
next(createError(404));
}
【问题讨论】:
-
您能分享一下您在 js 中使用
http-errors的位置吗?
标签: javascript node.js npm