首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jade (1.0+) Node.js Express应用程序中的模板错误:“复制键”"id“未指定。

Jade (1.0+) Node.js Express应用程序中的模板错误:“复制键”"id“未指定。
EN

Stack Overflow用户
提问于 2014-01-02 23:53:44
回答 1查看 1.4K关注 0票数 1

谢谢你在这方面的任何建议:

在我的快递应用程序中,我将向Jade模板传递几个参数,该模板现在会生成这个致命错误:

Duplicate key "id" is not allowed.

(据我所能收集的信息,我不会将任何索引"id“的参数传递到模板中)

该应用程序在JADE0.32.0中运行良好,但与任何版本的1.0+都不同。

下面是构造参数数组的代码(函数:setJadeVars,第29行),然后将该数组传递到jade模板(第63行):

https://github.com/rfcx/rfcx-api-express/blob/master/routes/index.js

错误似乎与将参数传递到模板无关,因为只有当我尝试使用参数时才会发生错误(也就是说,如果我传入参数,但在任何地方都不调用它们,呈现就会很好)。

如果有帮助,下面是我要传递到模板中的对象的console.log转储:

代码语言:javascript
复制
{ current_page: 
   [ 'about',
     'About',
     '/about',
     'Rainforest Connection | About',
     true,
     false ],
  app_version: '832292378e7a',
  node_env: 'development',
  title: 'Title (development)',
  segment_io_client_id: 'wimr8bjvcr',
  addthis_pubid: 'ra-xxx',
  bootstrap_cdn: '/vendor',
  googlelibs_cdn: '/vendor',
  videojs_cdn: '/vendor/video.js',
  cdnjs_cdn: '/vendor',
  rfcx_cdn: '/cdn',
  rfcx_vendor_cdn: '/vendor',
  rfcx_static_cdn: '//x-static.s3.amazonaws.com',
  nav_items: 
   [ [ 'intro',
       'Home',
       '/',
       'Rainforest Connection | Protecting rainforests with real-time data',
       true,
       false ],
     [ 'about',
       'About',
       '/about',
       'Rainforest Connection | About',
       true,
       false ],
     [ 'get_involved',
       'Get Involved',
       '/get_involved',
       'Rainforest Connection | Get Involved',
       true,
       false ],
     [ 'blog',
       'Blog',
       '/blog',
       'Rainforest Connection | Blog',
       false,
       false ],
     [ 'team',
       'Team',
       '/team',
       'Rainforest Connection | Team',
       false,
       false ],
     [ 'tumblr',
       'Tumblr',
       'http://tumblr.rfcx.org/',
       'Rainforest Connection | ',
       true,
       false ],
     [ 'video',
       null,
       '/video',
       'Rainforest Connection | Rainforest Connection | Protecting rainforests with real-time data',
       false,
       true,
       {} ] ],
  social_media: 
   [ [ 'github',
       '[link redacted for stack-overflow]',
       'github-square',
       'Fork our repos on Github!' ],
     [ 'instagram',
       '[link redacted for stack-overflow]',
       'instagram',
       'Check us out on Instagram!' ],
     [ 'flickr',
       'http://flickr.com/photos/rainforestcx/',
       'flickr',
       'Check us out on Flickr!' ],
     [ 'linkedin',
       '[link redacted for stack-overflow]',
       'linkedin-square',
       'Check us out on LinkedIn!' ],
     [ 'google-plus',
       '[link redacted for stack-overflow]',
       'google-plus-square',
       'Check us out on Google+!' ],
     [ 'twitter',
       '[link redacted for stack-overflow]',
       'twitter-square',
       'Check us out on Twitter!' ],
     [ 'facebook',
       '[link redacted for stack-overflow]',
       'facebook-square',
       'Check us out on Facebook!' ] ]
}

任何可能导致错误的想法都将不胜感激!谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-01-04 00:46:43

此错误是由如下代码引起的:

代码语言:javascript
复制
span#foo#bar

或者这个:

代码语言:javascript
复制
span#foo(id='bar')

注意两个id标签。我最近也遇到过这种情况。如果你找不到它,就拿出冒犯的玉石模板,我可以指着它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20894152

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档