簡體   English   中英

本地主機的 Vercel CLI 問題

[英]Vercel CLI issue with localhost

我已經安裝了 Vercel CLI 來在本地測試無服務器功能。
存儲庫是這樣的: https ://github.com/LuigiImVector/github-badge/tree/eda8e1954fc81d69142c461b89f32e9f7635f6f2

使用vercel dev我啟動了 localhost 服務器,但出現了問題。 主頁 ( index.html ) 已正確加載,但是當我轉到http://localhost:3000/apihttp://localhost:3000/api/index.js時出現錯誤。

圖像錯誤

控制台中出現的整個錯誤消息是這樣的:

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. Received protocol 'c:'
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:782:11)
    at Loader.resolve (internal/modules/esm/loader.js:88:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:241:28)
    at Loader.import (internal/modules/esm/loader.js:176:28)
    at importModuleDynamically (internal/modules/cjs/loader.js:1011:27)
    at exports.importModuleDynamicallyCallback (internal/process/esm_loader.js:30:14)
    at getListener (C:\Users\luigi\AppData\Roaming\npm\node_modules\vercel\node_modules\@vercel\node\dist\launcher.js:66:24)
    at C:\Users\luigi\AppData\Roaming\npm\node_modules\vercel\node_modules\@vercel\node\dist\launcher.js:77:5
    at main (C:\Users\luigi\AppData\Roaming\npm\node_modules\vercel\node_modules\@vercel\node\dist\dev-server.js:103:14)
    at processTicksAndRejections (internal/process/task_queues.js:95:5) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
Error! Failed to complete request to /api/index.js: Error: read ECONNRESET

在 Vercel 上的站點中,一切正常( https://github-badge-three.vercel.app/api?years=9 ),但在 localhost 中卻沒有。

更新 Vercel CLI: npm install -g vercel (如果這不起作用,請嘗試npm install -g vercel@canary

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM