2016-01-02 5 views
5

私はbrowserifyで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) 

はここにここに私のindex.jsである私のpackage.json

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

です。

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

riot.mount(blogView); 

私はちょうどエラーと間違っていると混同しています。 jadeをhtmlにコンパイルすることができます。ここにdocsの例があります。 https://github.com/jhthorsen/riotify#usage

答えて

2

jadeがインストールされていない可能性があります。私はちょうどそのエラーのスタックトレースを確認したのだが、この行を指す:

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

のでjadeを追加し、再度実行してみてください。

+2

実際、htmlを前処理する必要がない限り(私はしなかった)、 'template'オプションを取り除くことができます。 –

関連する問題