Cargo invocation has failed: Error: exit code: 101.解決辦法
Rust語言
在VS Code中編輯Rust “ Thebook ” 中第二章 “ 猜猜看 ”遊戲程式碼時,嘗試在cargo.toml 中新增rand依賴項,即
cargo.toml
[dependencies]
rand = "0.7.3"
在命令列鍵入$cargo build之後,發現了
Cargo invocation has failed: Error: exit code: 101.
這樣一條彈窗提醒,提示crate啟用失敗。
OUTPUT視窗提示如下:
Running `cargo build --bin=instances --package=instances
--message-format=json`...
Blocking waiting for file lock on package cache
Updating crates.io index warning: spurious network error (2 tries remaining): failed to send request: 操作超時 ; class=Os (2)
warning: spurious network error (1 tries remaining): failed to send request: 操作超時 ; class=Os (2)
error: failed to get `rand` as a dependency of package `instances v1.46.0 (D:\DataFiles\CodesLearning\RUST\Instances)`
Caused by: failed to load source for dependency `rand`
Caused by: Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by: failed to fetch `https://github.com/rust-lang/crates.io-index`
Caused by: failed to send request: 操作超時 ; class=Os (2)
最後發現是連線Github網站超時導致。該問題在每次啟動VS Code後,檢查rust-analyzer外掛版本時也會無視已安裝的更新而彈窗提醒。
下面提供連線Github的方法,此方法同樣適用於網頁登入Github連線不上的問題。一般都是通過hosts檔案中新增ip地址解決。
host檔案在C://Windows/system32/dreivrs/etc目錄中。可以先右鍵 -> 屬性更改User的寫入許可權後,再進行編輯儲存。
通過https://github.com.ipaddress.com/www.github.com可以得知當前github網站ip地址已經更改,因此不少文章中提到的hosts修改已經失效。這裡提供向hosts檔案中新增的程式碼如下:
#Github
140.82.113.4 github.com
當然,更推薦先用上述連結查詢之後再進行更改,防止ip地址更新失效。最後,別忘了儲存hosts檔案,並取消User的寫入許可權。
相關文章
- 簡易的解決方式linker command failed with exit code 1 (use -v to see invocation)AI
- Navicat tnt版本提示“failed to save password error code”的解決辦法AIError
- command 'gcc' failed with exit status 1錯誤問題的解決辦法GCAI
- RuntimeError: cuDNN error: CUDNN_STATUS_EXECUTION_FAILED解決辦法ErrorDNNAI
- 【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解決辦法Error
- 【ERROR】OPatch failed with error code 73ErrorAI
- Command CompileSwift failed with a nonzero exit code in Xcode 10CompileSwiftAIXCode
- Permission denied Command PhaseScriptExecution failed with a nonzero exit codeAI
- OPatch failed with error code 73AIError
- “command-not-found has crashed” 解決辦法 (*unsolved)
- Job for mysqld.service failed because the control process exited with error code錯誤解決MySqlAIError
- Vue 下 ESLint 的 error 解決辦法VueEsLintError
- ERROR 1290 (HY000) 解決辦法Error
- git did not exit cleanly(exit code 128)報錯的部分原因及解決方法Git
- weblogic報錯: OPatch failed with error code 73WebAIError
- IDEA提示failed to load JVM DLL的解決辦法IdeaAIJVM
- Rustup-init.exe安裝後執行cargo run 報錯:`link.exe` returned an unexpected error的解決辦法RustCargoError
- git push程式碼時的‘git did not exit cleanly (exit code 1)‘問題解決Git
- PHP Warning: exec() has been disabled for security 問題解決辦法PHP
- vscode中Git: host key verification failed的解決辦法VSCodeGitAI
- idea 報錯maven [ERROR] Maven execution terminated abnormally (exit code 1)IdeaMavenErrorORM
- 解決 yum clean all Error rpmdb open failedErrorAI
- mysqldump error1066 錯誤的解決辦法MySqlError
- org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection 解決辦法SpringFrameworkJDBCOTGExceptionAI
- Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the processErrorExceptionAI
- 解決方案 | MiKTex SSL connect error code 35Error
- Docker Desktop啟動報錯:Failed to set version to docker-desktop: exit code: -1DockerAI
- SVN報錯“Failed to run the WC DB work queue associated with”解決辦法AI
- docker dm_task_run failed 啟動失敗解決辦法DockerAI
- Job for docker.service failed because the control process exited with error codeDockerAIError
- iOS開發除錯之報錯:Command /usr/bin/codesign failed with exit code 1iOS除錯AI
- PyCharm啟動報錯:Failed to create JVM.解決辦法之一PyCharmAIJVM
- pecl PHP Parse error: syntax error, unexpected 'new' (T_NEW) 以及 XML缺失解決辦法PHPErrorXML
- Job for mysqld.service failed because the control process exited with error code...MySqlAIError
- 帝國CMSr的Fatal error:Allowed memory size of的解決辦法Error
- dbeaver 升級 24.1.x 版本提示 An error has occurred 的解決Error
- ubuntu下pig報錯ERROR 2999: Unexpected internal error. Failed to create DataStorage的解決UbuntuErrorAIAST
- 在Linux Mint中安裝Clion遇到CMake Error的解決辦法LinuxError