SyntaxError:acorn.js中的意外标记

时间:2017-12-21 22:59:15

标签: javascript node.js pug

我尝试使用express.js和jade模板创建登录表单,然后我发现了这样的错误:

SyntaxError: Unexpected token (16:50)
    at Parser.pp.raise (C:\project\restaurant\node_modules\acorn\dist\acorn.js:943:13)
    at Parser.pp.unexpected (C:\project\restaurant\node_modules\acorn\dist\acorn.js:1503:8)
    at Parser.pp.expect (C:\project\restaurant\node_modules\acorn\dist\acorn.js:1497:26)
    at Parser.pp.parseParenExpression (C:\project\restaurant\node_modules\acorn\dist\acorn.js:342:8)
    at Parser.pp.parseParenAndDistinguishExpression (C:\project\restaurant\node_modules\acorn\dist\acorn.js:399:16)
    at Parser.pp.parseExprAtom (C:\project\restaurant\node_modules\acorn\dist\acorn.js:297:19)
    at Parser.pp.parseExprSubscripts (C:\project\restaurant\node_modules\acorn\dist\acorn.js:216:19)
    at Parser.pp.parseMaybeUnary (C:\project\restaurant\node_modules\acorn\dist\acorn.js:197:19)
    at Parser.pp.parseExprOps (C:\project\restaurant\node_modules\acorn\dist\acorn.js:151:19)
    at Parser.pp.parseMaybeConditional (C:\project\restaurant\node_modules\acorn\dist\acorn.js:133:19)

这是我layout.jade的代码:

doctype html

html

        head
                title #{Project Restaurant Finder} 
                link(rel='stylesheet', href='/stylesheets/style.css')
        body
                block content   
        Footer
                p contact : aliwumpa@gmail.com or 081222843778

这是我index.jade的代码:

extends layout

block content

h1 = login form

    form(name ="login restaurant finder",method ="post")
        div.input
            span.label Login as Guest
            input(type="text", name="username")
        div.actions
            input(type="submit", value="ok")

1 个答案:

答案 0 :(得分:0)

在评论中回答gandreadis

此部分标题#{Project Restaurant Finder}绝对需要修复:更改标题Project Restaurant Finder或标题#{variable_name},其中variable_name是您传递给模板以赋予其变量的变量标题。