node.js - Jade - 意外的标识符

标签 node.js express pug

我使用以下 NodeJS 路线:

server.get('/', function(req, res) {
  res.render('index');
});

我的index.jade 文件似乎有一个错误,因为它告诉我:

SyntaxError: Unexpected identifier at Object.Function (unknown source) at Object.compile (/media/Data/development/private/PicoBudget/node_modules/jade/lib/jade.js:160:8) at Function.compile (/media/Data/development/private/PicoBudget/node_modules/express/lib/view.js:68:33) at ServerResponse._render (/media/Data/development/private/PicoBudget/node_modules/express/lib/view.js:417:18) at ServerResponse.render (/media/Data/development/private/PicoBudget/node_modules/express/lib/view.js:318:17) at /media/Data/development/private/PicoBudget/app.js:51:7 at callbacks (/media/Data/development/private/PicoBudget/node_modules/express/lib/router/index.js:272:11) at param (/media/Data/development/private/PicoBudget/node_modules/express/lib/router/index.js:246:11) at pass (/media/Data/development/private/PicoBudget/node_modules/express/lib/router/index.js:253:5) at Router._dispatch (/media/Data/development/private/PicoBudget/node_modules/express/lib/router/index.js:280:5)

这是我的index.jade:

doctype 5
html(lang="en")
  head
    title= PicoBudget - Expense tracking tool
    link(href='bootstrap/css/bootstrap.css', rel='stylesheet')
    style(type='text/css')
      body {
        padding-top: 100px;
        padding-bottom: 40px;
      }
    link(href='bootstrap/css/bootstrap-responsive.css', rel='stylesheet')
    link(href='css/main.css', rel='stylesheet')

    script(type='text/javascript')
      <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
      <![endif]-->
  body
    header
      nav
        div(class='navbar navbar-fixed-top')
          div(class='navbar-inner')
            div(class='container')
              a(class='btn btn-navbar', data-toggle='collapse', data-target='.nav-collapse')
                span(class='icon-bar')
                span(class='icon-bar')
                span(class='icon-bar')
              a(class='brand', href='http://localhost:1337) PicoBudget
              div(class='nav-collapse')
                ul(class='nav')
                  li(class='active')
                    a(href='http://localhost:1337) Home
                  li
                    a(href='http://localhost:1337/login) Register
                  li
                    a(href='http://localhost:1337/faq) FAQ
                  li
                    a(href='http://localhost:1337/about) About
                  li
                    a(href='http://localhost:1337/dashboard) Dashboard
                form(class='form-inline pull-right, action='http://localhost:1337/authenticated', method='POST')
                  input(type='text', class='input-small', placeholder='Email' name='emailInput'
                  input(type='password', class='input-small', placeholder='Password', name='passwordInput')
                  label(class='checkbox')
                    input(type='checkbox')
                    Remember me
                  button(type='submit', class='btn')
                    Sign in

    div(class='container')
      section#content
        div(class='hero-unit')
          h1 Easily manage your money
          p
            Ever wondered where your money goes? What do you spend the most money on? PicoBudget is a simple tool which features transactions, budgeting and reporting. Using Basic PicoBudget is absolutely free. If you enjoy it, though, you can get even more features with PicoBudget Premium!
          p
            Currently PicoBudget is under construction. Feel free to come back to check it out when it launched!

        div(class='row')
          div(class='span4')
            h2 Introduction
            p
              What is PicoBudget? Who is it for? Why should you use it?
            p
              a(class='btn', href='http://localhost:1337/introduction')
                Read more &raquo;
          div(class='span4')
            h2 FAQ
            p
              We listed the frequently asked questions. It should cover most of your questions.
            p
              a(class='btn', href='http://localhost:1337/faq')
                View FAQ &raquo;
          div(class='span4')
            h2 Premium
            p
              With a premium account you get even more features. It already starts from 0.00!
            p
              a(class='btn', href='http://localhost:1337/premium')
                Read more &raquo;
    hr

    footer
      p
        &copy; PicoBudget.com 2012


    script(src='bootstrap/js/bootstrap.js')
    script(src='js/libs/jquery-1.7.2.js')

最佳答案

我修复了它:

  • 修复了所有缺失的内容'
  • 删除了标题后的 =(第 4 行)

关于node.js - Jade - 意外的标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11073047/

相关文章:

javascript - 函数编写者如何调用 getByName 。功能

node.js - 以正确的方式使用 Azure blob 容器?

node.js - node-sass-middleware 不使用 Express 渲染

mysql - 在 React 上尝试 .map 内的“收藏夹”选项卡。我无法更改 mysql 表上的 bool 类型

reactjs - 将 CRA 部署到 s3 并使用 Express 提供服务

javascript - 我应该在 Node.js 中使用哪种客户端模板?

node.js - Paypal 定期付款重定向到 Paypal 的主页

javascript - nodejs async.whilst 只会调用一次

node.js - Jade 模板引擎(node.js下): multi-line block without pipe symbol

javascript - 如何将用户创建的复选框值传递到另一个页面?