意外文本”,在 pug 文件中 javascript

unexpected text ", in pug file javascript

我遇到以下错误。我不知道如何解决它。我刚开始处理哈巴狗文件。它显示以下错误:

Error: /home/nobin/jadeApp/views/show_message.pug:9:33
    7|       else
    8|          h3 New person, 
  > 9|             name: #{person.name}, 
---------------------------------------^
    10|             age: #{person.age} and 
    11|             nationality: #{person.nationality} added!

unexpected text ", 
  "
    at makeError (/home/nobin/jadeApp/node_modules/pug-error/index.js:34:13)
    at Lexer.error (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:62:15)
    at Lexer.fail (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:1629:10)
    at Lexer.advance (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:1694:12)
    at Lexer.callLexerFunction (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:1647:23)
    at Lexer.getTokens (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:1706:12)
    at lex (/home/nobin/jadeApp/node_modules/pug-lexer/index.js:12:42)
    at Object.lex (/home/nobin/jadeApp/node_modules/pug/lib/index.js:104:9)
    at Function.loadString [as string] (/home/nobin/jadeApp/node_modules/pug-load/index.js:53:24)
    at compileBody (/home/nobin/jadeApp/node_modules/pug/lib/index.js:82:18)

我的 show_message.pug 文件:

html
   head
      title Person
   body
      if(type == "error")
         h3(style = "color:red") #{message}
      else
         h3 New person, 
            name: #{person.name}, 
            age: #{person.age} and 
            nationality: #{person.nationality} added!

嗯,我也不熟练,但根据你的错误,你可能想尝试删除

末尾的逗号
.
.
    name: #{person.name}, 

.
.
  name: #{person.name}