By this point I have hit the same Cargo
error several times in the past few months. I have the latest rustup
supplied Cargo
version and this is still happening when I use cargo install
on my Kubuntu command line ...
Example
$ cargo install csvlens
error: invalid character `…` in registry name: `…`, the first character must be a Unicode XID start character (most letters or `_`)
[EDIT-1] as suggested I'm pasting in the Cargo config.toml
file at the end of the post. As far as I know this is a default config. I see a few lines with the expression like: 'token = "…" '
. Something like that "...
" resembles the error message.
[EDIT-2] ... I commented out all lines using the '= "…"
' syntax. I was able to install a crate via Cargo -)
Previous searches have not shown me any kind of explaination. I'd like to get past this and learn ...
Where is the problem?
- Is this a fault with my
cargo
orrust
orgit
set-up or environment? - Is it at the crate's registry entry and I just have to wait for it to get fixed?
- A cargo bug, a supplier project bug or a local bug/problem?
- Is this a fault with my
What is the problem, why does it keep happening? -I don't recall when the
cargo install
stopped working for me, it would be within the last 4 or 5 monthsHow to work around the problem and actually install some of these useful looking crates/commands?
At this point I would welcome some idea about what's happening/happened so I can get on with things and put "cargo instal" in the siding until things can be resolved.
inclusion: ~/.config/Cargo/config.toml
## Cargo config.toml
#
# * see: [Configuration, The Cargo Book](.html)
#
## paths = ["/path/to/override"] # path dependency overrides
[alias] # command aliases
[build]
jobs = 4 # number of parallel jobs, defaults to # of CPUs
incremental = true # whether or not to enable incremental compilation
dep-info-basedir = "…" # path for the base directory for targets in depfiles
[doc]
browser = "firefox" # browser to use with `cargo doc --open`,
# overrides the `BROWSER` environment variable
[env]
## Set ENV_VAR_NAME=value for any process run by Cargo
# ENV_VAR_NAME = "value"
#
# Set even if already present in environment
# ENV_VAR_NAME_2 = { value = "value", force = true }
#
# Value is relative to .cargo directory containing `config.toml`, make absolute
# ENV_VAR_NAME_3 = { value = "relative/path", relative = true }
[future-incompat-report]
frequency = 'always' # when to display a notification about a future incompat report
[cargo-new]
vcs = "git" # VCS to use ('git', 'hg', 'pijul', 'fossil', 'none')
[http]
# debug = false # HTTP debugging
# proxy = "host:port" # HTTP proxy in libcurl format
# ssl-version = "tlsv1.3" # TLS version to use
# ssl-version.max = "tlsv1.3" # maximum TLS version
# ssl-version.min = "tlsv1.1" # minimum TLS version
# timeout = 30 # timeout for each HTTP request, in seconds
# low-speed-limit = 10 # network timeout threshold (bytes/sec)
# cainfo = "cert.pem" # path to Certificate Authority (CA) bundle
# check-revoke = true # check for SSL certificate revocation
# multiplexing = true # HTTP/2 multiplexing
# user-agent = "…" # the user-agent header
[install]
# root = "/some/path" # `cargo install` destination directory
[net]
# retry = 3 # network retries
# git-fetch-with-cli = true # use the `git` executable for git operations
# offline = true # do not access the network
[net.ssh]
known-hosts = ["..."] # known SSH host keys
## [patch.<registry>]
## Same keys as for [patch] in Cargo.toml
# [profile.<name>] # Modify profile settings via config.
# inherits = "dev" # Inherits settings from [profile.dev].
# opt-level = 0 # Optimization level.
# debug = true # Include debug info.
# split-debuginfo = '...' # Debug info splitting behavior.
# strip = "none" # Removes symbols or debuginfo.
# debug-assertions = true # Enables debug assertions.
# overflow-checks = true # Enables runtime integer overflow checks.
# lto = false # Sets link-time optimization.
# panic = 'unwind' # The panic strategy.
# incremental = true # Incremental compilation.
# codegen-units = 16 # Number of code generation units.
# rpath = false # Sets the rpath linking option.
# [profile.<name>.build-override] # Overrides build-script settings.
# Same keys for a normal profile.
# [profile.<name>.package.<name>] # Override profile for a package.
# Same keys for a normal profile (minus `panic`, `lto`, and `rpath`).
# [registries.<name>] # registries other than crates.io
# index = "…" # URL of the registry index
# token = "…" # authentication token for the registry
[registry]
default = "…" # name of the default registry
token = "…" # authentication token for crates.io
# [source.<name>] # source definition and replacement
# replace-with = "…" # replace this source with the given named source
# directory = "…" # path to a directory source
# registry = "…" # URL to a registry source
# local-registry = "…" # path to a local registry source
# git = "…" # URL of a git repository source
# branch = "…" # branch name for the git repository
# tag = "…" # tag name for the git repository
# rev = "…" # revision for the git repository
# [target.<triple>]
# linker = "…" # linker to use
# runner = "…" # wrapper to run executables
# rustflags = ["…", "…"] # custom flags for `rustc`
# [target.<cfg>]
# runner = "…" # wrapper to run executables
# rustflags = ["…", "…"] # custom flags for `rustc`
# [target.<triple>.<links>] # `links` build script override
# rustc-link-lib = ["foo"]
# rustc-link-search = ["/path/to/foo"]
# rustc-flags = ["-L", "/some/path"]
# rustc-cfg = ['key="value"']
# rustc-env = {key = "value"}
# rustc-cdylib-link-arg = ["…"]
# metadata_key1 = "value"
# metadata_key2 = "value"
[term]
quiet = false # whether cargo output is quiet
verbose = false # whether cargo provides verbose output
color = 'auto' # whether cargo colorizes output
hyperlinks = true # whether cargo inserts links into output
progress.when = 'auto' # whether cargo shows progress bar
progress.width = 80 # width of progress bar
By this point I have hit the same Cargo
error several times in the past few months. I have the latest rustup
supplied Cargo
version and this is still happening when I use cargo install
on my Kubuntu command line ...
Example
$ cargo install csvlens
error: invalid character `…` in registry name: `…`, the first character must be a Unicode XID start character (most letters or `_`)
[EDIT-1] as suggested I'm pasting in the Cargo config.toml
file at the end of the post. As far as I know this is a default config. I see a few lines with the expression like: 'token = "…" '
. Something like that "...
" resembles the error message.
[EDIT-2] ... I commented out all lines using the '= "…"
' syntax. I was able to install a crate via Cargo -)
Previous searches have not shown me any kind of explaination. I'd like to get past this and learn ...
Where is the problem?
- Is this a fault with my
cargo
orrust
orgit
set-up or environment? - Is it at the crate's registry entry and I just have to wait for it to get fixed?
- A cargo bug, a supplier project bug or a local bug/problem?
- Is this a fault with my
What is the problem, why does it keep happening? -I don't recall when the
cargo install
stopped working for me, it would be within the last 4 or 5 monthsHow to work around the problem and actually install some of these useful looking crates/commands?
At this point I would welcome some idea about what's happening/happened so I can get on with things and put "cargo instal" in the siding until things can be resolved.
inclusion: ~/.config/Cargo/config.toml
## Cargo config.toml
#
# * see: [Configuration, The Cargo Book](https://doc.rust-lang./cargo/reference/config.html)
#
## paths = ["/path/to/override"] # path dependency overrides
[alias] # command aliases
[build]
jobs = 4 # number of parallel jobs, defaults to # of CPUs
incremental = true # whether or not to enable incremental compilation
dep-info-basedir = "…" # path for the base directory for targets in depfiles
[doc]
browser = "firefox" # browser to use with `cargo doc --open`,
# overrides the `BROWSER` environment variable
[env]
## Set ENV_VAR_NAME=value for any process run by Cargo
# ENV_VAR_NAME = "value"
#
# Set even if already present in environment
# ENV_VAR_NAME_2 = { value = "value", force = true }
#
# Value is relative to .cargo directory containing `config.toml`, make absolute
# ENV_VAR_NAME_3 = { value = "relative/path", relative = true }
[future-incompat-report]
frequency = 'always' # when to display a notification about a future incompat report
[cargo-new]
vcs = "git" # VCS to use ('git', 'hg', 'pijul', 'fossil', 'none')
[http]
# debug = false # HTTP debugging
# proxy = "host:port" # HTTP proxy in libcurl format
# ssl-version = "tlsv1.3" # TLS version to use
# ssl-version.max = "tlsv1.3" # maximum TLS version
# ssl-version.min = "tlsv1.1" # minimum TLS version
# timeout = 30 # timeout for each HTTP request, in seconds
# low-speed-limit = 10 # network timeout threshold (bytes/sec)
# cainfo = "cert.pem" # path to Certificate Authority (CA) bundle
# check-revoke = true # check for SSL certificate revocation
# multiplexing = true # HTTP/2 multiplexing
# user-agent = "…" # the user-agent header
[install]
# root = "/some/path" # `cargo install` destination directory
[net]
# retry = 3 # network retries
# git-fetch-with-cli = true # use the `git` executable for git operations
# offline = true # do not access the network
[net.ssh]
known-hosts = ["..."] # known SSH host keys
## [patch.<registry>]
## Same keys as for [patch] in Cargo.toml
# [profile.<name>] # Modify profile settings via config.
# inherits = "dev" # Inherits settings from [profile.dev].
# opt-level = 0 # Optimization level.
# debug = true # Include debug info.
# split-debuginfo = '...' # Debug info splitting behavior.
# strip = "none" # Removes symbols or debuginfo.
# debug-assertions = true # Enables debug assertions.
# overflow-checks = true # Enables runtime integer overflow checks.
# lto = false # Sets link-time optimization.
# panic = 'unwind' # The panic strategy.
# incremental = true # Incremental compilation.
# codegen-units = 16 # Number of code generation units.
# rpath = false # Sets the rpath linking option.
# [profile.<name>.build-override] # Overrides build-script settings.
# Same keys for a normal profile.
# [profile.<name>.package.<name>] # Override profile for a package.
# Same keys for a normal profile (minus `panic`, `lto`, and `rpath`).
# [registries.<name>] # registries other than crates.io
# index = "…" # URL of the registry index
# token = "…" # authentication token for the registry
[registry]
default = "…" # name of the default registry
token = "…" # authentication token for crates.io
# [source.<name>] # source definition and replacement
# replace-with = "…" # replace this source with the given named source
# directory = "…" # path to a directory source
# registry = "…" # URL to a registry source
# local-registry = "…" # path to a local registry source
# git = "…" # URL of a git repository source
# branch = "…" # branch name for the git repository
# tag = "…" # tag name for the git repository
# rev = "…" # revision for the git repository
# [target.<triple>]
# linker = "…" # linker to use
# runner = "…" # wrapper to run executables
# rustflags = ["…", "…"] # custom flags for `rustc`
# [target.<cfg>]
# runner = "…" # wrapper to run executables
# rustflags = ["…", "…"] # custom flags for `rustc`
# [target.<triple>.<links>] # `links` build script override
# rustc-link-lib = ["foo"]
# rustc-link-search = ["/path/to/foo"]
# rustc-flags = ["-L", "/some/path"]
# rustc-cfg = ['key="value"']
# rustc-env = {key = "value"}
# rustc-cdylib-link-arg = ["…"]
# metadata_key1 = "value"
# metadata_key2 = "value"
[term]
quiet = false # whether cargo output is quiet
verbose = false # whether cargo provides verbose output
color = 'auto' # whether cargo colorizes output
hyperlinks = true # whether cargo inserts links into output
progress.when = 'auto' # whether cargo shows progress bar
progress.width = 80 # width of progress bar
Share
Improve this question
edited Mar 9 at 13:06
will
asked Mar 8 at 10:30
willwill
5,0918 gold badges57 silver badges95 bronze badges
5
|
2 Answers
Reset to default 0Problem resolved. I have successfully finished: "cargo install csvlens
".
The problem as noted with EDIT-2 were lines that looked like:
token = "…"
in the config file. By commenting all places with the: xxx = "…"
, and running the install command, the csvlens
is now installed.
$ cargo install csvlens
Updating crates.io index
Downloaded csvlens v0.12.0
Downloaded 1 crate (65.3 KB) in 0.36s
....
Compiling csvlens v0.12.0
Finished `release` profile [optimized] target(s) in 4m 10s
Installing /home/william/.config/cargo/bin/csvlens
Installed package `csvlens v0.12.0` (executable `csvlens`)
$
Those: "…"
strings look like placeholders. I think they ought to be comments if they are optional or are not always used(???). Thanks to @Kevin Reid for the suggestion.
It appears that you or someone else has copied the documentation for the config file in place of the config.toml
file — the incorrect text appears to be an edited version of https://doc.rust-lang./cargo/reference/config.html#configuration-format. That text is intended to display the rough syntax of all options, even in cases where there is no value that corresponds to the default, so it is not a working configuration file by itself.
You should delete all of this text and write only the options that you actually want to customize. (Most users do not need any configuration at all.)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744898176a4599821.html
rust
andcargo
. May be I need some kind of referesh on the Cargo registry -- Is there such a thing?? – will Commented Mar 8 at 14:32cargo
). This error suggests that you have an incorrect configuration file. Can you please check all of the configuration file locations for aconfig.toml
, and edit your question to include the contents of each one you find? (Your problem could likely be solved by deleting all of them, but sharing them will help identify how they got in the bad state and what a minimal fix is.) – Kevin Reid Commented Mar 8 at 15:32