silicann / raml2html-werk-theme

a bulma and open-color based single-page theme that is easily searchable and offline-ready
MIT License
2 stars 5 forks source link

theme fails to render if installed globally (Unable to call `isIterable`, which is undefined or falsey) #2

Open krodyrobi opened 6 years ago

krodyrobi commented 6 years ago

error message

(raml2html-werk-theme\index.nunjucks) [Line 37, Column 33]
  Template render error: (raml2html-werk-theme\index.nunjucks)
  Template render error: (raml2html-werk-theme\sidebar.nunjucks)
  Template render error: (raml2html-werk-theme\index.nunjucks)
  Template render error: (raml2html-werk-theme\index.nunjucks)
  Template render error: (raml2html-werk-theme\index.nunjucks) [Line 173, Column 16]
  Error: Unable to call `isIterable`, which is undefined or falsey

versions node: 8.11.3 npm: 6.1.0 raml2html: 7.1.0 raml2html-werk-theme: 1.0.3

api.raml

#%RAML 1.0
version: 1.0
title: Some title
protocols: HTTPS

/test/{some}:
  description: description
  uriParameters:
    some:
      required: true
      type: string
  get:
    responses:
      204:

It errors the same way even for an almost empty raml file.

#%RAML 1.0
version: 1.0
title: Some title

command

raml2html --theme raml2html-werk-theme --input api.raml --output docs.html
kmohrf commented 6 years ago

Thank you for reporting this. It’s weird. I have problems reproducing this error, but you’re not the first one to encounter it. Can you tell me something more about your system configuration and where and how you’ve installed raml2html and raml2html-werk-theme? Is there any other output before this error?

I’ve tried this with: Arch Linux: node==10.5.0, npm==6.1.0 Debian Stretch: node==8.11.3, npm==5.6.0

And just to be sure we’re using the exact same versions, could you:

  1. download this zip file,
  2. extract it, and
  3. run npm install && npm run build inside the test-raml directory?
krodyrobi commented 6 years ago

Weirdly enough installed locally it works.

Running a windows 10 machine and installed the theme and raml2html globally.

npm list -g --depth 0

+-- @angular/cli@6.0.0
+-- api-designer@0.4.1
+-- npm@6.1.0
+-- raml2html@7.1.0
+-- raml2html-werk-theme@1.0.3
+-- request@2.87.0
`-- typescript@2.8.1

npm list -g --depth 1
+-- raml2html@7.1.0
| +-- marked@0.3.12
| +-- minimize@2.1.0
| +-- nunjucks@2.5.2
| +-- nunjucks-markdown@2.0.1
| +-- pretty@2.0.0
| +-- raml2html-default-theme@2.8.0
| +-- raml2obj@6.0.0
| `-- yargs@10.1.2
+-- raml2html-werk-theme@1.0.3
| +-- bulma@0.6.2
| +-- delegate@3.2.0
| +-- details-element-polyfill@2.0.1
| +-- fs-extra@5.0.0
| +-- highlight.js@9.12.0
| +-- html-minifier@3.5.18
| +-- luett@2.6.0
| +-- markdown-it@8.4.1
| +-- markdown-it-deflist@2.0.3
| +-- markdown-it-sanitizer@0.4.3
| +-- open-color@1.6.3
| `-- stroll.js@3.0.3
kmohrf commented 6 years ago

Ok. So the deciding fact seems to be that you’ve installed it globally. I have no idea why that would change anything, but I’ll look into it. As you’ve already figured out the work-around seems to be installing raml2html and the theme locally.

GauntletPL commented 4 years ago

The issue is most probably caused by the missing dependency on nunjucks. This is a stacktrace I'm getting after digging a little deeper:

Error: Cannot find module 'nunjucks'
Require stack:
- ...\npm\node_modules\raml2html-werk-theme\config.js
- ...\npm\node_modules\raml2html\index.js
- ...\npm\node_modules\raml2html\bin\raml2html
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:683:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (...\npm\node_modules\raml2html-werk-theme\config.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:643:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:683:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '...\\npm\\node_modules\\raml2html-werk-theme\\config.js',
    '...\\npm\\node_modules\\raml2html\\index.js',
    '...\\npm\\node_modules\\raml2html\\bin\\raml2html'
  ]
funsheep commented 4 years ago

Based on @GauntletPL comment, I installed nunjucks package globally and the theme worked and the error was gone.