asciidoctor.js: Unable to have the sample.js working

Hi guys,

Iโ€™m currently trying to use this asciidoctor.js working for my project. I would like to make it work in a React project created in ES6 (transpilled using babel) I tried to make it work without any success, so I decided to try the code from README :

npm init -y npm install -S asciidoctor.js

Create the file sample.js (from README file)

var asciidoctor = require('asciidoctor.js')();
var content = "http://asciidoctor.org[*Asciidoctor*] " +
    "running on http://opalrb.org[_Opal_] " +
    "brings AsciiDoc to Node.js!";
var html = asciidoctor.convert(content);
console.log(html); 

And here is the output :

โ‡’  node sample.js
/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/asciidoctor.js/dist/asciidoctor.js:35658
          } else { throw $err; }
                   ^

TypeError: Cannot read property 'join' of null
    at Date.$$zone [as $zone] (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/opal-runtime/src/opal.js:18510:62)
    at /Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/opal-runtime/src/opal.js:18691:28
    at RegExp.[Symbol.replace] (native)
    at String.replace (native)
    at Date.$$strftime [as $strftime] (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/opal-runtime/src/opal.js:18554:21)
    at /Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/asciidoctor.js/dist/asciidoctor.js:25954:24
    at $Document.$$initialize [as $initialize] (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/asciidoctor.js/dist/asciidoctor.js:25961:14)
    at Object.Opal.send (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/opal-runtime/src/opal.js:1663:21)
    at singleton_class_alloc.TMP_Class_new_4 [as $new] (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/opal-runtime/src/opal.js:3441:12)
    at module_constructor.$$load [as $load] (/Users/remigoyard/Code/perso/babel-asccidoctor/node_modules/asciidoctor.js/dist/asciidoctor.js:35624:67)

Once I will i this working, i will try to make it work with babel โ€ฆ

I am running on a Mac OS (10.12.4)

And node version is : v7.4.0

Does anyone has any ideas ?

Thanks

Remi

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (12 by maintainers)

Most upvoted comments

No worries! Actually you did nothing wrong ๐Ÿ˜…

The latest release of asciidoctor-cli is using Asciidoctor.js 1.5.5-4: https://github.com/asciidoctor/asciidoctor-cli.js/blob/v1.5.5-beta.3/package.json

Iโ€™ve just published a new version of asciidoctor-cli@1.5.6-rc.1. This version is not bound anymore to a specific version of Asciidoctor.js.

What you need to do is: npm i -g asciidoctor.js asciidoctor-cli@1.5.6-rc.1

This command should install the latest version of both asciidoctor.js and asciidoctor-cli (globally):

asciidoctorjs --version
1.5.6-rc.1

Let me know if itโ€™s working for you ๐Ÿ˜‰