Jade-cli - 保存文件夹结构会出错

时间:2016-11-28 16:12:44

标签: node.js npm pug

我正在使用jade-cli将我的项目从.jade文件编译成.html。

Jade文件具有以下层次结构:

components
  views
  templates
  ...

我希望渲染结果具有相同的文件夹结构,并尝试使用-H属性,如文档中所述:https://www.npmjs.com/package/jade-cli

但是当我使用命令jade -P -H src -o dst时,npm会返回以下错误:

silly lifecycle @~build: Args: [ '/d /s /c', 'jade -P -H src -o dst' ]
    12 silly lifecycle @~build: Returned: code: 1  signal: null
info lifecycle @~build: Failed to exec build script
verbose stack Error: @ build: `jade -P -H src -o dst`
verbose stack Exit status 1
verbose stack     at EventEmitter.<anonymous> (C:\Program     Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
verbose stack     at emitTwo (events.js:106:13)
 verbose stack     at EventEmitter.emit (events.js:191:7)
verbose stack     at ChildProcess.<anonymous> (C:\Program     Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
verbose stack     at emitTwo (events.js:106:13)
verbose stack     at ChildProcess.emit (events.js:191:7)
verbose stack     at maybeClose (internal/child_process.js:877:16)
verbose stack     at Process.ChildProcess._handle.onexit     (internal/child_process.js:226:5)
error Windows_NT 6.1.7601
error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program     Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
error node v6.9.1
error npm  v3.10.8
error code ELIFECYCLE
error @ build: `jade -P -H src -o dst`
error Exit status 1
error Failed at the @ build script 'jade -P -H src -o     dst'.
error Make sure you have the latest version of node.js and npm installed.
error If you do, this is most likely a problem with the  package,
error not with npm itself.
error Tell the author that this fails on your system:
error     jade -P -H src -o dst
error You can get information on how to open an issue for this project     with:
error     npm bugs
error Or if that isn't available, you can get their info via:
error     npm owner ls
error There is likely additional logging output above.
verbose exit [ 1, true ]

如果排除-H,一切运行正常。什么似乎是问题?

npm版本:6.9.1 玉版:1.11.0

1 个答案:

答案 0 :(得分:0)

问题已经解决。我的错误是我认为 jade-cli 是普通玉器包的一部分。似乎您必须使用

单独安装它
npm i jade-cli -g

-g用于全局安装。

此编译成功完成并创建所有必要的文件夹架构

相关问题