bounty将在2天后过期。回答此问题可获得+100声望奖励。Louis希望引起更多人关注此问题。
在构建应用程序时,我遇到了来自第三方库的警告,如下所示:
warn - ./node_modules/follow-redirects/debug.js
Module not found: Can't resolve 'debug' in 'G:\Workspace\node\MERN\client\node_modules\follow-redirects'
Did you mean './debug'?
Requests that should resolve in the current directory need to start with './'.
Requests that start with a name are treated as module requests and resolve within module directories (node_modules).
If changing the source code is not an option there is also a resolve options called 'preferRelative' which tries to resolve these kind of requests in the current directory too.
我的堆栈:
"dependencies": {
"@fortawesome/fontawesome-free": "^6.2.1",
"axios": "^1.2.2",
"bootstrap": "^5.2.3",
"mdb-ui-kit": "^6.0.1",
"next": "^13.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-toastify": "^9.1.1"
}
以下重定向中debug.js的内容:
var debug;
module.exports = function () {
if (!debug) {
try {
/* eslint global-require: off */
debug = require("debug")("follow-redirects");
}
catch (error) { /* */ }
if (typeof debug !== "function") {
debug = function () { /* */ };
}
}
debug.apply(null, arguments);
};
并在index.js文件中导入:
var url = require("url");
var URL = url.URL;
var http = require("http");
var https = require("https");
var Writable = require("stream").Writable;
var assert = require("assert");
var debug = require("./debug");
我已经检查了他们回购和问题,但显然没有人报告过,所以我想知道它是否与我的具体设置?
我也尝试过删除node_modules并通过npm重新安装所有依赖项,但没有成功。
1条答案
按热度按时间lymnna711#
我在你的“依赖项”下看不到
follow-redirects
包。将其从“devDependencies”替换为“dependencies”,因为它不是开发包
如果您使用的是TypeScript,则可能还需要安装
@types/follow-redirects
: