cargo-graph icon indicating copy to clipboard operation
cargo-graph copied to clipboard

No root table found for toml file

Open f-fr opened this issue 7 years ago • 15 comments

When running cargo graph on an arbitrary project I receive the following error message:

% cargo graph
error: No root table found for toml file

I have no idea what this error means or how I can get more information about the problem. Any ideas?

f-fr avatar Nov 15 '17 16:11 f-fr

This is caused by recent changes to Cargo. #38 fixes the issue.

remram44 avatar Nov 19 '17 06:11 remram44

unfortunately cargo install still installs an older version - could you push a new one?

Trolldemorted avatar Nov 27 '17 23:11 Trolldemorted

Yes please. I came to submit the same issue.

shaleh avatar Nov 28 '17 20:11 shaleh

Same here

aochagavia avatar Nov 30 '17 18:11 aochagavia

Until a new version is pushed, you can add the following to your Cargo.lock to get around the issue temporarily.

[root]
name="your-package-name"

Doing so will cause other cargo commands to fail, however. That's because future/current cargo will see that as duplicating the project definition.

ChristopherMacGown avatar Dec 09 '17 17:12 ChristopherMacGown

@ChristopherMacGown Thanks for the tip!

I had to add version as well to Cargo.lock, like so:

[root]
name="your-package-name"
version="package-version"

worked like a charm.

laumann avatar Jan 10 '18 08:01 laumann

cargo +nightly install --git https://github.com/kbknapp/cargo-graph --force worked for me.

SimonSapin avatar Jan 17 '18 16:01 SimonSapin

I just tripped on this. What is the status? According to the earlier comment #38 fixes this, which was merged like 6 months ago.

chisophugis avatar Jun 28 '18 05:06 chisophugis

Ditto, ended up going with the forced git install.

sstelfox avatar Jul 03 '18 20:07 sstelfox

Bump.

crawford avatar Jul 23 '18 20:07 crawford

Is this the same as error: No name for package in toml file ?

spearman avatar Nov 21 '18 05:11 spearman

Any update on this?

Boscop avatar Jan 22 '19 11:01 Boscop

I was able to get it going by following steps on a CentOS 7 OS.

  • check out cargo-count repo.
[[pi@centos7 cargo-count]$ pwd
/home/pi/gb/cargo-count
[pi@centos7 cargo-count]$
  • commands
 sudo yum install -y graphviz
 git clone https://github.com/kbknapp/cargo-graph && cd cargo-graph
 cargo build --release
 cargo install  --force
 cd ../cargo-count/
 cargo graph  --optional-line-style dashed --optional-line-color red --optional-shape box --build-shape diamond --build-color green --build-line-color orange > cargo-count.dot
 dot -Tpng > rainbow-graph.png cargo-count.dot

[pi@centos7 cargo-count]$ ls -l *.png
-rw-rw-r-- 1 pi pi  59023 Feb 21 07:00 cargo-count.png
-rw-rw-r-- 1 pi pi 144496 Feb 21 07:10 rainbow-graph.png
[pi@centos7 cargo-count]$


tjyang avatar Feb 21 '19 12:02 tjyang

You can use my fork instead, which includes the fix for this (as well as for many, many other bugs), plus has some new features (plus is actually maintained).

cargo install cargo-deps

See the new features with

cargo deps -h

mrcnski avatar Feb 23 '19 15:02 mrcnski

Thanks @m-cat for your pointer. I will follow cargo-deps instead.

[pi@centos7 cargo-deps]$ cargo  deps -h
cargo-deps 1.0.3
Marcin S. <[email protected]>:Kevin K. <[email protected]>:Max New <[email protected]>
Cargo subcommand for building dependency graphs of Rust projects.

USAGE:
    cargo deps [FLAGS] [OPTIONS]

FLAGS:
        --all-deps            Include all dependencies in the graph. Can be used with --no-regular-deps
        --build-deps          Include build dependencies in the graph (purple)
        --dev-deps            Include dev dependencies in the graph (blue)
    -h, --help                Prints help information
        --include-orphans     Don't purge orphan nodes (yellow). This is useful in some workspaces
    -I, --include-versions    Include the dependency version on nodes
        --no-regular-deps     Exclude regular dependencies from the graph
        --optional-deps       Include optional dependencies in the graph (red)
    -V, --version             Prints version information

OPTIONS:
    -o, --dot-file <PATH>           Output file [default: stdout]
        --filter <DEPNAMES>...      Only display provided deps
        --manifest-path <PATH>      Specify location of manifest file [default: Cargo.toml]
        --subgraph <DEPNAMES>...    Group provided deps in their own subgraph
        --subgraph-name <NAME>      Optional name of subgraph
[pi@centos7 cargo-deps]$

tjyang avatar Feb 23 '19 15:02 tjyang