2014-01-24 201 views
1

我没有太多熟悉节点JS,但我被迫使用节点JS推出在Heroku。奇怪节点JS错误

这一切都进行得很顺利,大概要到前几天,但我不知道为什么,但它突然给了这么多错误。

Error: /app/index.jade:9 
    7| meta(name='viewport', content='target-densitydpi=device-dpi, width=device-width, user-scalable=no, maximum-scale=1, minimum-scale=1') 
    8| link(rel='stylesheet', href='/stylesheets/bootstrap.min.css', media='screen') 
> 9| link(rel='stylesheet', href='stylesheets/jquery-ui.css', media='screen') 
10| link(rel='stylesheet', href='stylesheets/jquery.pnotify.default.css', media='screen') 
11| link(rel='stylesheet', href='stylesheets/jquery.pnotify.default.icons.css', media='screen') 
12| link(rel='stylesheet', href='stylesheets/app.css', media='screen') 

unexpected text at Object.Lexer.fail (/app/node_modules/jade/lib/lexer.js:804:11) 
at Object.Lexer.next (/app/node_modules/jade/lib/lexer.js:863:15) 
at Object.Lexer.lookahead (/app/node_modules/jade/lib/lexer.js:113:46) 
at Parser.lookahead (/app/node_modules/jade/lib/parser.js:111:23) 
at Parser.peek (/app/node_modules/jade/lib/parser.js:88:17) 
at Parser.tag (/app/node_modules/jade/lib/parser.js:704:22) 
at Parser.parseTag (/app/node_modules/jade/lib/parser.js:690:17) 
at Parser.parseExpr (/app/node_modules/jade/lib/parser.js:199:21) 
at Parser.block (/app/node_modules/jade/lib/parser.js:660:25) 
at Parser.tag (/app/node_modules/jade/lib/parser.js:777:26) 

这就是我的index.jade约为

doctype html 
html(lang="en") 
    head 
    meta(name='apple-mobile-web-app-capable', content='yes') 
    meta(name='apple-mobile-web-app-status-bar-style', content='black') 
    meta(name='viewport', content='target-densitydpi=device-dpi, width=device-width, user-scalable=no, maximum-scale=1, minimum-scale=1') 
    link(rel='stylesheet', href='/stylesheets/bootstrap.min.css', media='screen') 
    link(rel='stylesheet', href='stylesheets/jquery-ui.css', media='screen') 
    link(rel='stylesheet', href='stylesheets/jquery.pnotify.default.css', media='screen') 
    link(rel='stylesheet', href='stylesheets/jquery.pnotify.default.icons.css', media='screen') 

任何建议,为什么就变成错了吗?

+0

请使用代码标签包装。这是编辑框中的小花括号。读取输出非常困难。 – juanpaco

+0

[有没有玉模板语法检查器/验证?](http://stackoverflow.com/questions/14173144/is-there-a-jade-template-syntax-checker-validator) –

+0

什么是你的package.json外观喜欢? – Alex

回答

0

试着改变你的玉

doctype html 
html(lang="en") 
    head 
    meta(name='apple-mobile-web-app-capable', content='yes') 
    meta(name='apple-mobile-web-app-status-bar-style', content='black') 
    meta(name='viewport', content='target-densitydpi=device-dpi, width=device-width, user-scalable=no, maximum-scale=1, minimum-scale=1') 
    link(rel='stylesheet', href='/stylesheets/bootstrap.min.css', media='screen') 
    link(rel='stylesheet', href='/stylesheets/jquery-ui.css', media='screen') 
    link(rel='stylesheet', href='/stylesheets/jquery.pnotify.default.css', media='screen') 
    link(rel='stylesheet', href='/stylesheets/jquery.pnotify.default.icons.css', media='screen') 

正如@Max莱斯克称,在评论,你混合相对和绝对路径。

不知道为什么这样做会造成一个问题,但它是不是巧合,我觉得更多。

顺便说一句,我之所以要求看你的package.json是因为最近有一个更新翡翠NPM,才造成了您所报告的问题:

https://github.com/visionmedia/jade/issues/1347

如果你碰到这样的:

"jade" : "*" 
package.json

,将基本上意味着“安装最新版本”

所以,每次你推到Heroku的时候,它会更新你的玉版本到最新版本,从而引入任何重大更改。
我怀疑这是发生了什么事,前几天,造成这个错误(你推到的Heroku,迫使玉更新到最新版本)

这将是更符合package.json文件中指定版本号,以避免这个。

+0

更改为相对路径对我来说不起作用,但是,我试图使用0.35.0来实现玉器的功能。谢谢! – AlfredTK