rschroll / crosswords

Crossword client for Ubuntu
http://rschroll.github.io/crosswords
GNU General Public License v3.0
10 stars 6 forks source link

Incorrect javascript being produced (riot.tag2 is not a function) #20

Open rsbowen opened 7 years ago

rsbowen commented 7 years ago

When I run 'make tar', unpack the tarball, and go to index.html in Chrome, I get a blank page and in the console, this error:

Uncaught TypeError: riot.tag2 is not a function at tags.js:6

I noticed that in http://rschroll.github.io/crosswords/www/tags.js, this line is "riot.tag(...)" rather than "riot.tag2(...)". Manually search-and-replacing that in tags.js does get the page to display the menu, but going to a particular crossword does in fact display the first page but many other JS errors ensue. I suspect some kind of issue with a newer riot than was used to make the github one.

Version info:

$ npm -v 3.5.2 $ node -v v4.2.6 $ riot -v

riot-cli: 3.0.2 - https://github.com/riot/cli riot-compiler: 3.2.4 - https://github.com/riot/compiler

rsbowen commented 7 years ago

Looks like that node is wildly out of date -- something about the Ubuntu repos having an old node. I followed the directions here:

https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version

but the problem persists.

$ node -v v8.1.3

rsbowen commented 7 years ago

Update: yes, this was a versioning issue. The included riot.js is out of date. I tried dropping in the new riot.js, but there were errors I don't know how to fix. However,

$ sudo npm install riot@2.2.2 -g

works.

gitclem commented 5 years ago

I'm not sure exactly what's going on, since I'm a newbie with riot. BUT, I did discover this work around by trial and error.

Running the riot command line:

riot tags/foo.tag

generates a file foo.js which has a function call riot.tag2()

Now, when I tried to include the riot compiler code that came with the install:

<script src="node_modules/riot/riot+compiler.min.js"></script> I get the error about the missing riot.tag2 function. (This says riot v4.1.1)

When I look at the human readable file riot+compiler.js I can't find any riot.tag2 function definition

Poking around the internet, I found this replacement for the riot compiler:

<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.3.12/riot+compiler.min.js"></script>

which shows an older version of riot: version 2.3.12

If you look at the compiler source code, you can see that it DOES include a definition for riot.tag2.

My conclusion is the riot CLI command is out of sync with the riot javascript compiler for some reason.

So, it might be somebody deprecated riot.tag2() or maybe it got dropped by accident. I haven't spent enough time to figure out what the problem is.

My Configuration:

riot -v
  riot-cli:      5.1.2 - https://github.com/riot/cli
  riot-compiler: 3.6.0 - https://github.com/riot/compiler

node -v
v12.4.0

Mac OS X 10.14.5 (18F203)

I believe I installed riot with: yarn add riot

so maybe it's a problem with yarn or something... I don't know, being a newbie at this.