35

Since 0.9.3 I'm having some problems with meteor package dependencies, for example some third party packages don't declare all of their dependencies (like underscore, which would normally be included but not when used by another package).

Is there a simple way to show the tree of dependencies, much like npm does?

meteor list will show what's in your project

.meteor/versions will show all packages but I'm trying to find out what is including (or not) other packages.

currently I'm getting errors like the following, but haven't included Minimongoid afaik and grepping finds no reference to it.

W20141001-19:19:46.137(-7)? (STDERR) /Users/dc/.meteor/packages/meteor-tool/.1.0.33.he3qxx++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/fibers/future.js:173
W20141001-19:19:46.137(-7)? (STDERR)                        throw(ex);
W20141001-19:19:46.138(-7)? (STDERR)                              ^
W20141001-19:19:46.141(-7)? (STDERR) ReferenceError: Minimongoid is not defined
W20141001-19:19:46.141(-7)? (STDERR)     at collections/user.coffee:1:20
W20141001-19:19:46.141(-7)? (STDERR)     at /Users/dc/dev/shumi/package-dev/app/.meteor/local/build/programs/server/app/collections/user.coffee.js:24:3
W20141001-19:19:46.142(-7)? (STDERR)     at /Users/dc/dev/shumi/package-dev/app/.meteor/local/build/programs/server/boot.js:168:10
W20141001-19:19:46.142(-7)? (STDERR)     at Array.forEach (native)
W20141001-19:19:46.142(-7)? (STDERR)     at Function._.each._.forEach (/Users/dc/.meteor/packages/meteor-tool/.1.0.33.he3qxx++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20141001-19:19:46.142(-7)? (STDERR)     at /Users/dc/dev/shumi/package-dev/app/.meteor/local/build/programs/server/boot.js:82:5
1

4 Answers 4

37

While we're waiting for the official tools to have this functionality, here's the uglyslow vershion:

for p in `meteor list | grep '^[a-z]' | awk '{ print $1"@"$2 }'`; do echo "$p"; meteor show "$p" | grep -E '^  [a-z]'; echo; done

This will show the dependencies of all added packages. It parses the output of meteor list and meteor show package@version and will break when anything there changes.

1
15

As of Meteor v1.5.2 (released 2017-09-05) you can now see the full dependency tree like this:

meteor list --tree

Here's what the output looks like:

$ meteor list --tree

[email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected] (top level)
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected] (expanded above)
│ │ │ ├── [email protected] (top level)
│ │ │ ├─┬ [email protected]

The pull request was contributed by sdarnel and can be found here for those interested: https://github.com/meteor/meteor/pull/8936

2
  • 2
    This is the new answer! Thanks Adrian :-) Commented Feb 25, 2018 at 16:04
  • Is it possible to print this same tree view, but for ones own files in a Meteor project? Thanks.
    – drone1
    Commented Jun 6, 2022 at 21:42
3

Here's what I did...

I ran meteor list, and copied the output to notepad, to refer back to later.

Then, I went down the entire list, entering: meteor show <package> looking in the output for: Implies: whatever... that's the part that tells you what the particular package is including. Basically, the part of the output that says "Implies: something", those are the dependencies of the package you ran meteor show <package> for.

Then... if you take the packages in "Implies: foopackage", and run "meteor show foopackage" that will tell you that dependency's dependencies.

Basically, this is a crude solution to this problem which there is no official solution/feature/command for.

Good luck.

P.S. in my case, I wanted to see what was including iron:router, and through the above process, I determined it was useraccounts:semantic-ui that was including useraccounts:core, which in turn was including iron:router (which isn't in meteor list!)

See the following page for more info: https://github.com/meteor/meteor/issues/2853

2

I wrote some code here to build up a package tree, and make pictures like this:

enter image description here

It worked on the raw source code of the meteor distribution, so it'd need some tweaking to work on an actual app (and I cant help with that at the moment), but it'd be a start...

1
  • 1
    Nice looking, but could you also explain succinctly how your code works? That way if for some reason your repo gets hit by a bus the legacy is preserved.
    – Kyll
    Commented Sep 30, 2015 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.