Skip to content

Conversation

@jean-francois-labbe
Copy link
Contributor

Speedscope must be installed globally for the graph to be displayed.

Speedscope must be installed globally for the graph to be displayed.
@technicalpickles
Copy link
Collaborator

Did you get an error without this? We use npx to run it:

If any requested packages are not present in the local project dependencies, then they are installed to a folder in the npm cache, which is added to the PATH environment variable in the executed process. A prompt is printed (which can be suppressed by providing either --yes or --no).

Maybe the prompt is causing a problem 🤔

@jean-francois-labbe
Copy link
Contributor Author

jean-francois-labbe commented Mar 24, 2023

Absolutely. The error is not visible in the terminal.

This command
❯ open /var/folders/6v/dj23h5vd0ynd697fvtksqglw0000gn/T/speedscope-1679663586339-61260.html
Opens the browser but the page is blank.

cat the file the browser opens

❯ cat  /var/folders/6v/dj23h5vd0ynd697fvtksqglw0000gn/T/speedscope-1679663586339-61260.html
<script>window.location="file:///Users/jeff/.npm/_npx/61260/lib/node_modules/speedscope/dist/release/index.html#localProfilePath=/var/folders/6v/dj23h5vd0ynd697fvtksqglw0000gn/T/speedscope-1679663586339-61260.js"</script>

The generated html file is referring to speedscope index.html the file here

❯ ls /Users/jeff/.npm/_npx/61260/lib/node_modules/speedscope/dist/release/index.html
ls: /Users/jeff/.npm/_npx/61260/lib/node_modules/speedscope/dist/release/index.html: No such file or directory (os error 2).

But it doesn't exist on my computer.

So I looked at speedscope documentation and found the npm install -g speedscope command. I ran it. Now it works.

@technicalpickles
Copy link
Collaborator

Thanks, that's useful context. Mostly asking so I can make sure to solve this correctly and completely.

Before singed, I was using a command snippet that included npx, so if it did need to be installed, it was an interactive prompt so I could accept it. I adapted that snippet for this library, and seems I never didn't have speedscope installed 😮‍💨

At the very least, I think it's reasonable to check speedscope is available before calling, and don't try to open it in that case. We could call alternatively/additionally callnpx --yes speedscope to handle installing it, but that kinda seems rude 🤔

@technicalpickles technicalpickles merged commit 7c78b46 into rubyatscale:main Apr 10, 2023
@technicalpickles
Copy link
Collaborator

I think we can get better error checking that this is available, but this is an improvement over not having any docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants