Node.js Express应用程序中出现Jade(1.0+)模板错误:“不允许使用重复键”id“。

感谢您的任何build议:

在我的Express应用程序中 ,我将几个parameter passing给一个Jade模板,该模板现在会产生这个致命错误:

Duplicate key "id" is not allowed.

(从我可以收集,我没有传入任何参数与索引“id”到模板中)

该应用程序与翡翠0.32.0正常工作,但打破了任何版本1.0+。

这里是我构build参数数组(函数: setJadeVars ,第29行),然后将该数组传递到玉模板(第63行)的代码:

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

这个错误似乎并没有把parameter passing给模板,因为错误只发生在我尝试使用这些参数的时候(例如,如果我传入参数,但是不会在任何地方调用它们,就会发生渲染正好)。

如果有帮助,这里是我传递给模板的对象的console.log转储:

 { 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!' ] ] } 

任何可能导致错误的想法将深受赞赏! 谢谢!

这个错误是由这样的代码造成的:

 span#foo#bar 

或这个:

 span#foo(id='bar') 

注意两个id标签。 我最近也遇到这个。 如果找不到的话,请展示一下这个有问题的玉模板,我可以指点一下。