嗨,当我在node_modules中安装pug时(非全局)
我要在插入pug
示例
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
[.....]
# Specify options through a file:
$ echo "exports.doctype = 'html';" > options.js
$ pug -O options.js foo.pug
# or, JSON works too
$ echo '{"doctype": "html"}' > options.json
$ pug -O options.json foo.pug
我创建名为pug_tutorial
的目录
pug_tutorial
|- package.json
我的package.json是
{
"name": "its-dog",
"version": "0.0.1",
"description": "pug template engine",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"pug": "node_modules/.bin/pug"
},
"author": "",
"license": "ISC",
"devDependencies": {
"pug": "^2.0.3",
"pug-cli": "^1.0.0-alpha6"
}
}
首先使用npm install命令,一切正常
运行node_modules/.bin/pug --help
没问题
但是当我运行npm --help
cmd时,请提高zsh: command not found: pug
我该如何解决此错误?