没有findzsh:命令:grunt-init

我是gruntjs的新手,并试图让grunt-init模板启动并运行,但是我经常得到这个错误: zsh: command not found: grunt-init

当我运行安装它显示我所有这一切,所以它似乎是安装好

 → npm install -g grunt-init /Users/jsturgess/npm-global/bin/grunt-init -> /Users/jsturgess/npm-global/lib/node_modules/grunt-init/bin/grunt-init grunt-init@0.3.2 /Users/jsturgess/npm-global/lib/node_modules/grunt-init ├── semver@1.0.14 ├── colors@0.6.2 ├── async@0.2.10 ├── hooker@0.2.3 ├── lodash@2.4.1 ├── prompt@0.1.12 (async@0.1.22, pkginfo@0.3.0, winston@0.5.11) └── grunt@0.4.5 (which@1.0.9, dateformat@1.0.2-1.2.3, eventemitter2@0.4.14, getobject@0.1.0, rimraf@2.2.8, async@0.1.22, grunt-legacy-util@0.2.0, exit@0.1.2, nopt@1.0.10, lodash@0.9.2, coffee-script@1.3.3, underscore.string@2.2.1, glob@3.1.21, iconv-lite@0.2.11, grunt-legacy-log@0.1.1, js-yaml@2.0.5, minimatch@0.2.14, findup-sync@0.1.3) 

我已经按照grunt-init的安装说明创build了~/.grunt-init/目录,并通过命令给出了jquery模板

git clone https://github.com/gruntjs/grunt-init-jquery.git ~/.grunt-init/jquery

我需要做什么才能使用grunt-init命令?

好像你正在使用OhMyZsh。 您需要将Grunt文件添加到$ PATHvariables中。

cd进入你的主目录并find这个文件.zshrc,然后find该行

 export PATH= 

并修改它,如:

 export PATH="path_to_grunt:$PATH" 

':'用作多个path的分隔符。

你可能要找的是这里:

 export PATH="/usr/local/lib/node_modules/grunt-cli/bin/grunt:$PATH" 

通过撤消我在本文中完成的npm权限更改来修复此问题: https : //docs.npmjs.com/getting-started/fixing-npm-permissions

Interesting Posts