fwouts / viteshot

Viteshot 📸 is a fast and simple component screenshot tool based on Vite.

Home Page:https://viteshot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to run

rambabusaravanan opened this issue · comments

First thanks for this tool :)
But cannot run the tool, facing some issue

I am using node v14.16.1 in macOS Catalina 10.15.7

% yarn test:visual:new  
yarn run v1.22.5
$ viteshot
Pre-bundling dependencies:
  react
  react-dom
(this will be run only when your dependencies or config have changed)
(node:74962) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of undefined
    at /Users/rambabusaravanan/workspace/xxx/xxxxxx/node_modules/viteshot/lib/renderer.js:206:51
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:74962) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:74962) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


page.goto: Timeout 120000ms exceeded.
=========================== logs ===========================
navigating to "http://localhost:60397", waiting until "load"
============================================================
Note: use DEBUG=pw:api environment variable to capture Playwright logs.

Hey @rambabusaravanan, thanks for the bug report!

Would you be able to run viteshot debug and open the local url it gives you? You might have an interesting error in the console panel.

Better docs coming soon 😉

When opening the provided url, still same error

% yarn test:visual:new debug
yarn run v1.22.5
$ viteshot debug
Debug server running at http://localhost:3130
(node:10770) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'end' of undefined
    at /Users/rambabusaravanan/workspace/xxx/xxxxxx/node_modules/viteshot/lib/renderer.js:206:51
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10770) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10770) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Seems the exact line of error pointing is

res.setHeader("Content-Type", "text/html").end(html);

I updated the syntax in my local node_modules like below and it worked 👍

res.setHeader("Content-Type", "text/html");
res.end(html);

Easy! I'll make a PR to fix that, thank you 👍

Hey @rambabusaravanan, thanks again for reporting and investigating this. This should now be fixed in v0.1.3, just published :)