Javascript 意外标记';缩进';用玉与蚀

Javascript 意外标记';缩进';用玉与蚀,javascript,eclipse,node.js,angularjs,express,Javascript,Eclipse,Node.js,Angularjs,Express,我正在努力学习node、angular、javascript、express和jade。对于我来说,这是一个全新的、严格基于.net的代码环境 所以我找到了一个教程,但在第2步我遇到了麻烦。现在,这是我在index.jade文件Eclipse auto create on making a new project中所做教程的直接复制粘贴 我将以下代码插入到文件中 doctype 5 html(lang='en) head meta(charset='u

我正在努力学习node、angular、javascript、express和jade。对于我来说,这是一个全新的、严格基于.net的代码环境

所以我找到了一个教程,但在第2步我遇到了麻烦。现在,这是我在index.jade文件Eclipse auto create on making a new project中所做教程的直接复制粘贴

我将以下代码插入到文件中

    doctype 5
    html(lang='en)
      head
        meta(charset='utf-8')
        meta(name='viewport', content='width=device-width,initial-scale=1, user-scalable=no')
        title= title
        link(rel='stylesheet', href='//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css')
        link(rel='stylesheet', href='/stylesheets/style.css')
      body
        nav.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
          div.navbar-header
            a.navbar-brand(href='#/polls')= title
        div.container
          div

我得到了一个意外的标记“缩进”错误,就在html的头部。现在我对Eclipse和Jade都很在行,我不知道该怎么做。我已经搜索了stackoverflow,但似乎找不到与我问题完全相同的人,所以我完全迷路了。任何提示都将不胜感激。

您的文档应该不带任何空格(从文档的左侧开始),这可能是复制粘贴的副作用,下面是它的外观:

doctype html
html
  head
    meta(charset='utf-8')
    meta(name='viewport', content='width=device-width,initial-scale=1, user-scalable=no')
    title= title
    link(rel='stylesheet', href='//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css')
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    nav.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
      div.navbar-header
        a.navbar-brand(href='#/polls')= title
    div.container
      div
评论的答复:


如果这与代码中的情况完全相同,那么您需要取消所有代码的插入,它就会工作。Jade代码不能开始缩进。

如果这与代码中的缩进方式完全相同,那么您需要取消所有代码的缩进,它就会工作。Jade代码无法开始缩进。这似乎可以工作,谢谢:)但是现在我遇到了一个新错误,首先它说我必须使用html而不是doctype 5,如果我将doctype更改为html,我会遇到这个错误500错误:C:\Users\Kristian\workspace\polls\views\index.Jade:21 | doctype html>2 | html(lang='en)3 | head 4 | meta(charset='utf-8')5 | meta(name='viewport',content='width=device width,initial scale=1,user scalable=no')到达字符串末尾时未找到右括号。