本文介绍了翡翠的“文件名”选项需要使用“扩展”与“相对”路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有以下文件夹结构(简体): 项目 - app.js - views - index.jade - layout.jade - public ... 我想从index.jade生成一个index.html文件,在我的终端(Mac OS X)中使用以下命令: jade 然而,我收到一个错误消息: /usr/local/lib/node_modules/jade/lib/runtime.js:231 throw err; ^ 错误:Jade:1 1 |扩展./layout 2 | 3 |阻止mainContent 4 |中心 使用extends和相对路径需要filename选项在Parser.resolvePath(/ usr / local / lib / node_modules / jade / lib / parser.js:464:13)$ b $ .js:483:21) at Parser.parseExpr(/usr/local/lib/node_modules/jade/lib/parser.js:221:21) at Parser.parse(/ usr / local /lib/node_modules/jade/lib/parser.js:122:25) at parse(/usr/local/lib/node_modules/jade/lib/index.js:102:21) at Object.exports.compile(/usr/local/lib/node_modules/jade/lib/index.js:172:16)ReadStream 。 (/usr/local/lib/node_modules/jade/bin/jade.js:144:21)ReadStream.emit上的(events.js:117:20)_stream_readable.js上的:943: 16 at process._tickCallback(node.js:419:13) 我试着编辑导致index.jade中的错误的行: 扩展布局 和 扩展layout.jade 和 扩展./layout.jade 解决方案 $ b 任何想法如何解决这个问题? > 如果使用extend或include,必须使用文件名选项。 - filename/ absulute / path / to / your-file.jade I have following folder structure (simplified):project - app.js - views - index.jade - layout.jade - public...I want to generate an index.html file from index.jade and use the following command in my Terminal (Mac OS X):jade < index.jade > index.htmlHowever I receive an error saying:/usr/local/lib/node_modules/jade/lib/runtime.js:231 throw err; ^Error: Jade:1 1| extends ./layout2|3| block mainContent4| centerthe "filename" option is required to use "extends" with "relative" paths at Parser.resolvePath (/usr/local/lib/node_modules/jade/lib/parser.js:464:13) at Parser.parseExtends (/usr/local/lib/node_modules/jade/lib/parser.js:483:21) at Parser.parseExpr (/usr/local/lib/node_modules/jade/lib/parser.js:221:21) at Parser.parse (/usr/local/lib/node_modules/jade/lib/parser.js:122:25) at parse (/usr/local/lib/node_modules/jade/lib/index.js:102:21) at Object.exports.compile (/usr/local/lib/node_modules/jade/lib/index.js:172:16) at ReadStream. (/usr/local/lib/node_modules/jade/bin/jade.js:144:21) at ReadStream.emit (events.js:117:20) at _stream_readable.js:943:16 at process._tickCallback (node.js:419:13)I tried editing the line which causes the error in index.jade to:extends layoutandextends layout.jadeandextends ./layout.jadeAny idea how I could fix this? 解决方案 if use "extend" or "include", the filename option must be used.--filename "/absulute/path/to/your-file.jade" 这篇关于翡翠的“文件名”选项需要使用“扩展”与“相对”路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-24 07:19