0

前提node事先已经安装成功:
$ node -v
v8.3.0

1.安装pug
$ npm install -g pug
结果:+ pug@2.0.0-rc.3
added 57 packages in 5.928s

2.检证pug
$ pug -v
结果:-bash: pug: command not found

3.安装pug cli
$ npm install pug-cli -g
结果:/usr/local/bin/pug -> /usr/local/lib/node_modules/pug-cli/index.js+ pug-cli@1.0.0-alpha6
added 68 packages in 4.894s

4.检证pug
$ pug -v
结果:error: unknown option `-v'

请问一下是命令行写错了还是安装步骤有问题,为什么不能检证成功?

2个回答

0

已采纳
$ pug --version
pug version: 2.0.0-rc.3
pug-cli version: 1.0.0-alpha6

想看更多参数执行下面命令
pug --help

  Usage: pug [options] [dir|file ...]


  Options:

    -V, --version          output the version number
    -O, --obj <str|path>   JSON/JavaScript options object or file
    -o, --out <dir>        output the rendered HTML or compiled JavaScript to <dir>
    -p, --path <path>      filename used to resolve includes
    -b, --basedir <path>   path used as root directory to resolve absolute includes
    -P, --pretty           compile pretty HTML output
    -c, --client           compile function for client-side
    -n, --name <str>       the name of the compiled template (requires --client)
    -D, --no-debug         compile without debugging (smaller functions)
    -w, --watch            watch files for changes and automatically re-render
    -E, --extension <ext>  specify the output file extension
    -s, --silent           do not output logs
    --name-after-file      name the template after the last section of the file path (requires --client and overriden by --name)
    --doctype <str>        specify the doctype on the command line (useful if it is not specified by the template)
    -h, --help             output usage information
0
javascript@linux:~/i-node$ npm install pug-cli -g
/home/javascript/.nvm/versions/node/v8.2.1/bin/pug -> /home/javascript/.nvm/versions/node/v8.2.1/lib/node_modules/pug-cli/index.js
+ pug-cli@1.0.0-alpha6
added 68 packages in 28.331s
javascript@linux:~/i-node$ pug -V
pug version: 2.0.0-rc.3
pug-cli version: 1.0.0-alpha6

-V要大写。

撰写答案