html-sketchapp-cli icon indicating copy to clipboard operation
html-sketchapp-cli copied to clipboard

Timeout with local html file

Open tettoffensive opened this issue 7 years ago • 8 comments

I was just testing something out simple with this and plugged in a basic html file

<!DOCTYPE html>
<html lang="en">
  <title> </title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://unpkg.com/tachyons/css/tachyons.min.css">
  <body>
    <button data-sketch-symbol="Button/Primary" class="bw1-l br2 bg-dwyl-teal pa2 white fw1 tc ttu tracked">do what you love</button>
    <div data-sketch-text="Heading" class="f1 fw7 sans-serif lh-title">Headline 1</div>
    <div data-sketch-text="Body" class="sans-serif lh-copy">Body</div>
    <div data-sketch-color="#A463F2" class="pa4 bg-light-purple">&nbsp;</div>
  </body>
</html>

I followed the readme, but I'm getting a timeout error. Am I missing something?

$ npm install --global html-sketchapp-cli
$ html-sketchapp --file index.html --out-dir .
Error: Timeout
    at Timeout._onTimeout (/usr/local/lib/node_modules/html-sketchapp-cli/node_modules/wait-on/lib/wait-on.js:92:10)
    at ontimeout (timers.js:458:11)
    at tryOnTimeout (timers.js:296:5)
    at Timer.listOnTimeout (timers.js:259:5)

tettoffensive avatar Feb 13 '18 20:02 tettoffensive

I can't reproduce this locally, even when using this HTML and running with exactly the same command line args. Would you be able to dig in a bit further to narrow down your issue?

markdalgleish avatar Feb 13 '18 21:02 markdalgleish

@markdalgleish I'd be happy to, but I'm not sure where to start.

npm --version 5.6.0 html-sketchapp --version 0.0.6

tettoffensive avatar Feb 13 '18 21:02 tettoffensive

This error occurs if your --file argument has a typo, or isn't relative to where you're running the command, since the URL is resolved like this:

const url = argv.file ? `file://${path.join(process.cwd(), argv.file)}` : argv.url;

kidkuro avatar Feb 19 '18 08:02 kidkuro

If that's the problem, we could definitely assert the existence of the file first.

markdalgleish avatar Feb 19 '18 08:02 markdalgleish

I am also getting a timeout when running from localhost. The following are the command and error:

Command:

html-sketchapp --url http://localhost:3000 --out-dir sketch/

Error:

Error: Timeout
    at Timeout._onTimeout (/usr/local/lib/node_modules/html-sketchapp-cli/node_modules/wait-on/lib/wait-on.js:92:10)
    at ontimeout (timers.js:482:11)
    at tryOnTimeout (timers.js:317:5)
    at Timer.listOnTimeout (timers.js:277:5)

I assume this is related because I get the same error running with --serve and is related to the timeout error from above. File works for me, however if the path is correct.

calebdwilliams avatar Apr 13 '18 15:04 calebdwilliams

I could get rid of the timeout when specifiying networkidle2 instead of networkidle0 in node_modules/html-sketchapp-cli/bin/cli.js. Because I used hot reload and the websocket kept the connection open.

valoricDe avatar May 25 '18 14:05 valoricDe

Can you try v0.5.2? We just released a fix for our own timeout issue when using the serve option, which is quite probably related to yours.

markdalgleish avatar Jun 21 '18 05:06 markdalgleish

I just updated and the problem of the timeout persisted Error: Navigation Timeout Exceeded: 30000ms exceeded. Changing networkidle to mode 2 resolved the problem again.

valoricDe avatar Jun 27 '18 13:06 valoricDe