callgraph icon indicating copy to clipboard operation
callgraph copied to clipboard

Couldn't find preset "es2015"

Open jeromecovington opened this issue 7 years ago • 8 comments

This seems like the furthest along project for JavaScript call graph visualization. If there is another one you recommend over this, please let me know. Otherwise, I am running it on some source code that I am analyzing, and I am seeing this error.

$ callgraph index.js
Processing index.js
[Error: Couldn't find preset "es2015" relative to directory "/Users/my-name/my-project/lib"]
[TypeError: S.input is not a function]
Success! Check callgraph.png

And although the success message was displayed, and although the file callgraph.png has been generated, it is blank.

jeromecovington avatar Mar 02 '17 21:03 jeromecovington

By the time I started this repo, there weren't any good solutions out there.

I could not reproduce your error.

How did you install it? It seems your installation is missing a npm install.

gunar avatar Mar 06 '17 13:03 gunar

I have the same problem when I install callgraph globally. Babel is looking for es2015 presets on the current directory while it should look for it on the global directory.

I think you should define presets with an absolute path here instead of just es2015.

ghetolay avatar Apr 24 '17 10:04 ghetolay

I have the same problem when I install it by npm install -g callgraph (npm 2.15.11, node 4.4.7)

ontologiae avatar Jul 19 '17 08:07 ontologiae

It works if I do this in the directory of the file I want to analyse :

npm install  --save-dev babel-cli babel-preset-es2015
echo '{ "presets": ["es2015"] }' > .babelrc

ontologiae avatar Jul 19 '17 09:07 ontologiae

It seems we're out of luck.

image

Source

gunar avatar Jul 20 '17 01:07 gunar

Guess you cloud do this:

image

Source

gunar avatar Jul 20 '17 01:07 gunar

npm install -g babel-preset-es2015 + having a path to global modules in my NODE_PATH solved the issue for me. Maybe you can experiment with NODE_PATH environment variable in your module...

anatol-grabowski avatar Aug 19 '17 11:08 anatol-grabowski

Adding globally installed callgraph's node_modules directory to NODE_PATH, without having to install anything else, or creating a .babelrc file, solved this issue for me.

For example, on Windows:

export NODE_PATH='C:\node-v10.15.3-win-x64\node_modules\callgraph\node_modules'

mleguen avatar Sep 04 '19 10:09 mleguen