bukalapak/snowboard

Unable to render HTML

Closed this issue · 14 comments

installed globally via NPM as pr instructions. Running with
$ snowboard http .\.apib\API.apib

But all I am getting when visiting the page is the following showing in the console (chrome):

Uncaught ReferenceError: App is not defined
    at index-bundle.js:1

html -o and running it on my webserver directly produces same result.

I am also getting the following messages when building:

'C:Users<my user name redacted>AppDataRoaming
pm
ode_modulessnowboard    emplateswinter.svelte' is imported by C:\Users\<my user name redacted>\AppData\Local\Temp\tmp-136360LUY3KnE7gb7, but could not be resolved – treating it as an external dependency
No name was provided for external module 'C:Users<my user name redacted>AppDataRoaming
pm
ode_modulessnowboard    emplateswinter.svelte' in output.globals – guessing 'App'
No name was provided for external module 'C:Users<my user name redacted>AppDataRoaming
pm
ode_modulessnowboard    emplateswinter.svelte' in output.globals – guessing 'App'

Kinda at a loss here - because there isn't much to go on in terms of finding the problem. Running Snowboard 3.1.0 and NPM version 6.10.2 (latest)

Having error Uncaught ReferenceError: App is not defined is pretty weird. Looks like javascript bundle is not built correctly.

What operating system do you use? is it windows? We haven't tested it on Windows yet if you could run it using Linux or Windows subsystem for Linux (WSL) that would be great.

I am running on a windows computer yes. And I've tried both with PowerShell and with Git Bash. And it seem to run just fine under linux, so it seems to be a windows-only problem

I did some more testing, and cloned this repo and edited package.json to get an executable for windows also:

  "pkg": {
    "assets": [
      "templates"
    ],
    "targets": [
      "node8-linux-x64",
      "node8-macos-x64",
      "node12-win-x64"
    ]
  }

Still no luck.

Another thing I noticed though is this message when building:
$ Warning Cannot include addon %1 into executable. The addon must be distributed with executable as %2.

This leads me to believe that it might not include the templates folder (since that is the only thing I can see referred to as some sort of "addon" anywhere in the context of pkg) when building. And that is also what I was thinking when seeing the error messages in my original post.

When googling, I see there are some reports of similar issues with Rollup. But they are old issues from what I can tell.

I did some more digging and found this issue over at the pkg.

Seems like it just will not work on windows I guess

I am going to close this until more demands for Windows support. Meanwhile, you can use Linux or OSX to produce the documentation. Thanks, @jkhoel.

Hello! I would like to use snowboard however I'm running windows and ran into the exact same problem. I don't really understand what the problem is but is there any chance of this being fixed?

image

On win10

Hi @staadecker and @yeongjet, the issue of win10 is on snowboard's underlying parser, see apiaryio/drafter#628.

We can use a hack like replacing carriage return with a new line to make it work, as according to a comment in the issue.

Another workaround for Win10 users is to install Windows Subsystem for Linux (WSL) and run it from there. That is my solution currently, using Ubuntu.

Gives you access to everything you would normally have in a linux environment and you can SHIFT+right click a folder and get the option to run a shell from there. Super neat!

This project looks nice, but this issue is also preventing me from using it on windows :-/

And for my use case, the Linux subsystem would not be very practical I'm afraid

I'am also using windows and have the same issues.

But i tried it with WSL and It works!

Short guide:

  • Powershell with admin
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Install Ubuntu from the windows store and run it. Folow the steps.
  • In bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install build-essential
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
  • Change the IDE settings to use the WSL
    • Webstorm: Settings -> Tools -> Terminal -> Shell path -> Just type in bash
  • Open a terminal and execute sudo npm i

Same for me. Also Windows 10 user

I'am also using windows and have the same issues.

But i tried it with WSL and It works!

Short guide:

  • Powershell with admin
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Install Ubuntu from the windows store and run it. Folow the steps.
  • In bash
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential
sudo apt-get install build-essential
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
  • Change the IDE settings to use the WSL

    • Webstorm: Settings -> Tools -> Terminal -> Shell path -> Just type in bash
  • Open a terminal and execute sudo npm i

Worked great! Big tnx!

Ah man, 3h wasted until I found this issue!

Hi @staadecker and @yeongjet, the issue of win10 is on snowboard's underlying parser, see apiaryio/drafter#628.

We can use a hack like replacing carriage return with a new line to make it work, as according to a comment in the issue.

Switched an API I'm maintaining to Snowboard (since Aglio is long since dead with tonnes of vulnerable dependencies) and I'm getting this on Windows even with apib files that use LF line endings (not Windows' CRLF as per the issue).

WSL(2) works fine but not everyone has the ability to install WSL on their machines which blocks some contributors from previewing changes locally.