错误:缺少读取模板文件(hjs)

时间:2017-09-25 14:10:15

标签: node.js templating hogan.js

我正在学习NodeJS,而且我对hjs有一些问题。

This is the code

及以下是生成的错误:

 Error: missing read template file : H:\Users\stuffs\tutorials\views\users.hjs
    at Object.Hogan.fcompile (H:\Users\stuffs\tutorials\node_modules\hjs\lib\express.js:48:10)
    at View.Hogan.renderFile [as engine] (H:\Users\stuffs\tutorials\node_modules\hjs\lib\express.js:76:19)
    at View.render (H:\Users\stuffs\tutorials\node_modules\express\lib\view.js:127:8)
    at tryRender (H:\Users\stuffs\tutorials\node_modules\express\lib\application.js:640:10)
    at Function.render (H:\Users\stuffs\tutorials\node_modules\express\lib\application.js:592:3)
    at ServerResponse.render (H:\Users\stuffs\tutorials\node_modules\express\lib\response.js:971:7)
    at db.then (H:\Users\stuffs\tutorials\server.js:25:17)
    at tryCatcher (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\util.js:16:23)
    at Promise._settlePromiseFromHandler (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\promise.js:512:31)
    at Promise._settlePromise (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\promise.js:569:18)
    at Promise._settlePromise0 (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\promise.js:614:10)
    at Promise._settlePromises (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\promise.js:693:18)
    at Async._drainQueue (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\async.js:133:16)
    at Async._drainQueues (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\async.js:143:10)
    at Immediate.Async.drainQueues (H:\Users\stuffs\tutorials\node_modules\bluebird\js\release\async.js:17:14)
    at runCallback (timers.js:800:20)

这里也是hjs文件

<html>
<head>
    <title>
        {{title}}
    </title>
    <script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
</head>
<body>
    <div class="container">
        <div class="jumbotron">
            <h1>{{title}}</h1>
        </div>
        {{#users}}
        <ul>
            <li><a href="/viewtweets/{{id}}">{{username}}</a></li>
        </ul>   
        {{/#users}}
    </div>  

</body>
</html>
谢谢你! 我知道这可能是一些愚蠢的事情,但我仍然坚持这个错误,我无法在网上找到任何解决方案。

0 个答案:

没有答案