pnpm tauri build 出現(xiàn)proxy錯(cuò)誤

代理設(shè)置全局也不行,后面發(fā)現(xiàn)給rust cargo設(shè)置代理即可
如果出現(xiàn)跟我一樣的情況,可以試下,我改完之后就可以了

D:\xxxxx\xxxx>pnpm tauri build

> xxxx@0.0.0 tauri
> tauri "build"

     Running beforeBuildCommand `pnpm build`

> xxxxx@0.0.0 build 
> vite build

vite v5.1.6 building for production...
? 17 modules transformed.
dist/index.html                  0.48 kB │ gzip:  0.31 kB
dist/assets/index-Tn0Wq8gz.css   1.40 kB │ gzip:  0.66 kB
dist/assets/index-BP7kSTzz.js   57.74 kB │ gzip: 23.26 kB
? built in 627ms
    Updating crates.io index
warning: spurious network error (3 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
warning: spurious network error (2 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
warning: spurious network error (1 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
error: failed to get `serde` as a dependency of package `haolin v0.0.0 (D:\Project\haolingjiancai\haolin\src-tauri)`

Caused by:
  failed to query replaced source registry `crates-io`

Caused by:
  download of config.json failed

Caused by:
  failed to download from `https://index.crates.io/config.json`

Caused by:cargo update
  [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
       Error failed to build app: failed to build app
?ELIFECYCLE? Command failed with exit code 1.

如果出現(xiàn)該錯(cuò)誤,cd進(jìn)入項(xiàng)目的src-tauri文件夾,運(yùn)行cargo update

    Updating crates.io index
warning: spurious network error (3 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
warning: spurious network error (2 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
warning: spurious network error (1 tries remaining): [5] Couldn't resolve proxy name (Unsupported proxy syntax in ''http://127.0.0.1:7890'': Port number was not a decimal number between 0 and 65535)
error: failed to get `serde` as a dependency of package `haolin v0.0.0 (D:\Project\haolingjiancai\haolin\src-tauri)`

會(huì)發(fā)現(xiàn)出現(xiàn)同樣的錯(cuò)誤

這時(shí)候只要在 C:\Users\用戶名.cargo 下創(chuàng)建 config 文件(可以先創(chuàng)建config.txt文件,填充內(nèi)容后刪除后綴)
內(nèi)容設(shè)置

[http]
proxy = "127.0.0.1:7890"

[https]
proxy = "127.0.0.1:7890"

現(xiàn)在重新運(yùn)行會(huì)發(fā)現(xiàn)就正常了

第一次用tauri,發(fā)現(xiàn)好多錯(cuò)誤Google都找不到....

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容