我正在尝试通过命令行将 .jade 模板呈现为 HTML。我添加了 CLI 依赖项。我花了几个小时在语法上,但不断收到同样的错误。我知道它说缩进不一致,但我看不到在哪里。
watching views/_includes/sharedFunctions.jade
rendered views/_includes/sharedFunctions.html
watching views/add.jade
Error: ENOENT: no such file or directory, open 'views/layout.pug'
at views//add.jade line 1
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Function.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:69:13)
at Object.load.string.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:141:25)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:24:25
at walkAST (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:21:18)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:98:20
at Array.reduce (native)
at walkAndMergeNodes (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:97:18)
watching views/error.jade
Error: ENOENT: no such file or directory, open 'views/layout.pug'
at views//error.jade line 1
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Function.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:69:13)
at Object.load.string.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:141:25)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:24:25
at walkAST (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:21:18)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:98:20
at Array.reduce (native)
at walkAndMergeNodes (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:97:18)
watching views/find.jade
Error: ENOENT: no such file or directory, open 'views/layout.pug'
at views//find.jade line 1
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Function.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:69:13)
at Object.load.string.read (/usr/local/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:141:25)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:24:25
at walkAST (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:21:18)
at /usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:98:20
at Array.reduce (native)
at walkAndMergeNodes (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/node_modules/pug-walk/index.js:97:18)
watching views/index.jade
watching views/layout.jade
as a dependency of views/index.jade
rendered views/index.html
watching views/layout.jade
rendered views/layout.html
watching views/login.jade
Error: views//login.jade:34:9
32| | Sign in
33| p
> 34| .row
----------------^
35| .col-sm-6.col-md-4.col-md-offset-4
36| button.btn.btn-lg.btn-primary.btn-block(href='#') Sign Up
37| .row
Inconsistent indentation. Expecting either 4 or 8 spaces/tabs.
at makeError (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/node_modules/pug-error/index.js:32:13)
at Lexer.error (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:58:15)
at Lexer.indent (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:1208:18)
at Lexer.callLexerFunction (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:1315:23)
at Lexer.advance (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:1354:15)
at Lexer.callLexerFunction (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:1315:23)
at Lexer.getTokens (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:1371:12)
at lex (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-lexer/index.js:12:42)
at Object.load.string.lex (/usr/local/lib/node_modules/pug-cli/node_modules/pug/lib/index.js:93:27)
at Function.loadString [as string] (/usr/local/lib/node_modules/pug-cli/node_modules/pug/node_modules/pug-load/index.js:44:24)