asciidoctor / asciidoctor.js

:scroll: A JavaScript port of Asciidoctor, a modern implementation of AsciiDoc
https://asciidoctor.org
MIT License
734 stars 135 forks source link

Node cannot find asciidoctor.js at runtime #174

Closed lance closed 8 years ago

lance commented 8 years ago

I am using asciidcotor.js via metalsmith using metalsmith-asciidoctor. A few days ago, our CI started failing with Error: Cannot find module 'asciidoctor.js'. After digging a bit, it was easy to recreate the issue with the simplest of tests. Here is a package.json file.

{
   "name": "asciidoctor-test",
   "version": "1.0.0",
   "description": "Test if I can get asciidoctor.js to work",
   "main": "index.js",
   "scripts": {
     "test": "node index.js"
   },
   "author": "Lance Ball <lanceball@gmail.com> (http://lanceball.com)",
   "license": "MIT",
   "dependencies": {
     "asciidoctor.js": "^1.5.4"
   }
}

And a very very simple index.js test script.

var a = require('asciidoctor.js')();
console.log(a);

This fails with Error: Cannot find module 'asciidoctor.js'. I tried cloning the asciidoctor.js repository and running tests on the repo, but was not successful. I got a similar, but not the same, error.

Error: ENOENT: no such file or directory, open 'build/asciidoctor-all.js'
ggrossetie commented 8 years ago

Hello @lance, I think this is a duplicate of https://github.com/asciidoctor/asciidoctor.js/issues/172 ? The dist directory is missing from the npm package published on https://www.npmjs.com/

We will soon published a new version to fix this issue.

I tried cloning the asciidoctor.js repository and running tests on the repo, but was not successful. I got a similar, but not the same, error.

Could you tell me what command did you type to build the project ? npm run build ?

lance commented 8 years ago

Ah yes, it is a duplicate. Apologies.

To run asciidoctor.js tests I ran node npm/build.js and then npm run test. (I peeked at package.json).

ggrossetie commented 8 years ago

Ah yes, it is a duplicate. Apologies.

No worries.

To run asciidoctor.js tests I ran node npm/build.js and then npm run test. (I peeked at package.json).

This is working fine on my end, do you have any error prior to Error: ENOENT: no such file or directory, open 'build/asciidoctor-all.js'

node npm/build.js
clean
 - delete build directory
 - bundle install
Using rake 10.4.2
Using asciidoctor 1.5.4
Using concurrent-ruby 1.0.0
Using hike 1.2.3
Using sourcemap 0.1.1
Using rack 1.6.4
Using sprockets 3.5.2
Using tilt 2.0.2
Using opal 0.9.0.beta2
Using progressbar 0.21.0
Using bundler 1.9.9
Bundle complete! 4 Gemfile dependencies, 11 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

compile core lib
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I asciidoctor -g asciidoctor -r asciidoctor/converter/docbook5 > build/asciidoctor-docbook5.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I asciidoctor -g asciidoctor -r asciidoctor/converter/docbook45 > build/asciidoctor-docbook45.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I asciidoctor -g asciidoctor -r asciidoctor/extensions > build/asciidoctor-extensions.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I lib -I asciidoctor -g asciidoctor -r asciidoctor > build/asciidoctor-core.js

compile extensions-lab lib
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I extensions-lab/lib -I asciidoctor -g asciidoctor -r chrome-inline-macro > build/asciidoctor-chrome-inline-macro.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I extensions-lab/lib -I asciidoctor -g asciidoctor -r man-inline-macro > build/asciidoctor-man-inline-macro.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I extensions-lab/lib -I asciidoctor -g asciidoctor -r emoji-inline-macro > build/asciidoctor-emoji-inline-macro.js
 - opal --compile --dynamic-require ignore --no-opal --no-exit -I extensions-lab/lib -I asciidoctor -g asciidoctor -r chart-block-macro > build/asciidoctor-chart-block-macro.js

copy resources
 - copy asciidoctor.css

concat
 - npm core
 - npm core.min
 - npm extensions
 - npm docbook
 - Bower core + extensions
 - Bower docbook
 - Bower all
MINIFY environment variable is not defined, skipping "minify" task

>> Done in 6s
npm run test

> asciidoctor.js@1.5.4 test /home/guillaume/workspace/opensource/asciidoctor.js
> node npm/test/jasmine-bower.js && node npm/test/jasmine-bower-min.js && node npm/test/jasmine-npm.js

Jasmine Bower
Started
................

16 specs, 0 failures
Finished in 0.074 seconds
MINIFY environment variable is not defined, skipping "Jasmine Bower.min" task

Jasmine npm
Started
................

16 specs, 0 failures
Finished in 0.058 seconds
ggrossetie commented 8 years ago

@lance I've just released 1.5.5-1, could you please confirm that this is issue is now fixed ? Thanks!

lance commented 8 years ago

It is fixed for me now. Thanks!

Lance Ball http://lanceball.com

On Tue, Feb 2, 2016 at 4:25 PM, Guillaume Grossetie < notifications@github.com> wrote:

@lance https://github.com/lance I've just released 1.5.5-1, could you please confirm that this is issue is now fixed ? Thanks!

— Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoctor.js/issues/174#issuecomment-178829165 .

fbarrailla commented 8 years ago

Hi,

the 1.5.5-1 solves the problem but this version number doesn't match with the pattern ^1.5.2 (see gulp-asciidoctor package.json). Can you please publish a 1.5.6 to fix that ?

Thanks ;)

mojavelinux commented 8 years ago

This match is going to have to wait for the 1.5.5 release.