Skip to content

我把vant的源码下载到本地了,想着运行起来,但是总是报错 #9838

Answered by sonOfBigBrother
dabaoRain asked this question in Q&A
Discussion options

You must be logged in to vote

我也遇到相同问题,下载的是 dev 分支,按照错误日志提示,找到了可能出错的脚本代码,加了一句输出错误日志代码。

// packages/vant-cli/lib/common/constant.js

sync function getVantConfigAsync() {
    const require = createRequire(import.meta.url);
    delete require.cache[VANT_CONFIG_FILE];
    try {
        return (await import(VANT_CONFIG_FILE)).default;
    }
    catch (err) {
       // 自己加的
        console.error(err)
        return {};
    }
}
const vantConfig = await getVantConfigAsync();
export function getVantConfig() {
    return vantConfig;
}

运行pnpm run dev后在控制台看到了这个报错信息:

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Recei…

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@chenjiahan
Comment options

@chenjiahan
Comment options

Answer selected by chenjiahan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
4 participants
Converted from issue

This discussion was converted from issue #9837 on November 11, 2021 09:47.