[英]Unhandled rejection Error: Invalid path
When I npm run dev
a react project, it encounters an error like this: 当我
npm run dev
react项目时,它遇到如下错误:
Unhandled rejection Error: Invalid path './dist/'
Someone told me I should try an absolute path, but the error lies there again. 有人告诉我,我应该尝试绝对路径,但是错误仍然存在。
Unhandled rejection Error: Invalid path '/path/to/dist/'
I am confused~ anybody encountered this problem? 我很困惑〜有人遇到这个问题吗?
const output = {
path: './dist/',
filename: 'bundle.js',
publicPath: '../'
};
I think the leading ./
in your path might be the problem. 我认为您的路径中领先的
./
可能是问题所在。 As a work-around, you can try something like this: 解决方法是,您可以尝试执行以下操作:
path: require("path").resolve("./dist")
Also, from the error message, I think the absolute path you're using isn't working because it also has a leading .
另外,从错误消息中,我认为您正在使用的绝对路径不起作用,因为它也有一个前导
.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.