Просмотр с пользовательскими тегами Riot, выдающими ошибку типа

Я пытаюсь использовать настраиваемые теги riot с помощью браузера.

TypeError: Cannot read property 'render' of null while parsing file: /Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/app/views/blog.tag
at _html.jade (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:58:26)
at compileTemplate (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:692:10)
at Object.compile (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riot/node_modules/riot-compiler/dist/compiler.js:717:11)
at Stream.<anonymous> (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/index.js:16:58)
at _end (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/node_modules/through/index.js:65:9)
at Stream.stream.end (/Users/michaelmostachetti/Google_Drive/dev/web/mike_mostachetti_site/node_modules/riotify/node_modules/through/index.js:74:5)
at DestroyableTransform.onend (/Users/michaelmostachetti/npm-global/lib/node_modules/browserify/node_modules/readable-stream/lib/_stream_readable.js:545:10)
at DestroyableTransform.g (events.js:260:16)
at emitNone (events.js:72:20)
at DestroyableTransform.emit (events.js:166:7)

Вот мой package.json

"browserify": {
    "transform": [
      [
         "riotify",
         {
              "template": "jade"
         }
      ]
    ]
}

Вот мой index.js.

var riot        = require('riot'),
    blogView    = require('./views/blog.tag');

riot.mount(blogView);

Я просто запутался с ошибкой и что происходит не так. Я могу без проблем скомпилировать нефрит в html. Вот пример в документах. https://github.com/jhthorsen/riotify#usage


person mjmostachetti    schedule 02.01.2016    source источник


Ответы (1)


Возможно, это связано с тем, что зависимость jade не установлена. Я только что проверил трассировку стека этой ошибки, и она указывает на эту строку:

return _req('jade').render(html, extend({

Поэтому попробуйте добавить jade, а затем снова запустить его.

person Phil Cooper    schedule 11.01.2016
comment
На самом деле, если вам не нужно предварительно обрабатывать html (я этого не делал), вы можете избавиться от опции template. - person Phil Cooper; 11.01.2016