node.js - zsh:找不到命令:grunt-init

标签 node.js gruntjs zsh zshrc 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
<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="791e0b0c170d541017100d3949574a574b" rel="noreferrer noopener nofollow">[email protected]</a> /Users/jsturgess/npm-global/lib/node_modules/grunt-init
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e99a8c849f8c9ba9d8c7d9c7d8dd" rel="noreferrer noopener nofollow">[email protected]</a>
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7e1d1112110c0d3e4e5048504c" rel="noreferrer noopener nofollow">[email protected]</a>
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1574666c7b7655253b273b2425" rel="noreferrer noopener nofollow">[email protected]</a>
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84ecebebefe1f6c4b4aab6aab7" rel="noreferrer noopener nofollow">[email protected]</a>
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1975767d786a71592b372d3728" rel="noreferrer noopener nofollow">[email protected]</a>
├── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f585879a988581b5c5dbc4dbc4c7" rel="noreferrer noopener nofollow">[email protected]</a> (<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d2b3a1abbcb192e2fce3fce0e0" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a3d3c8c4cacdc5cce3938d908d93" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="94e3fdfae7e0fbfad4a4baa1baa5a5" rel="noreferrer noopener nofollow">[email protected]</a>)
└── <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99feebecf7edd9a9b7adb7ac" rel="noreferrer noopener nofollow">[email protected]</a> (<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b0c7d8d9d3d8f0819e809e89" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ee8a8f9a8b88819c838f9aaedfc0dec0dcc3dfc0dcc0dd" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="caafbcafa4beafa7a3bebeafb8f88afae4fee4fbfe" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1671736279747c737562562638273826" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d8aab1b5aab9be98eaf6eaf6e0" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fc9d8f85929fbcccd2cdd2cece" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a7c0d5d2c9d38acbc2c0c6c4de8ad2d3cecbe79789958997" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f095889984b0c0dec1dec2" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1f71706f6b5f2e312f312e2f" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b7dbd8d3d6c4dff787998e9985" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d2b1bdb4b4b7b7ffa1b1a0bba2a692e3fce1fce1" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="acd9c2c8c9dedfcfc3dec982dfd8dec5c2cbec9e829e829d" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5f3833303d1f6c716e716d6e" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3059535f5e461d5c59445570001e021e0101" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3a5d484f544e17565f5d5b59431756555d7a0a140b140b" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fb9188d6829a9697bbc9d5cbd5ce" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fd90949394909c899e95bdcdd3cfd3ccc9" rel="noreferrer noopener nofollow">[email protected]</a>, <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99fff0f7fdece9b4eae0f7fad9a9b7a8b7aa" rel="noreferrer noopener nofollow">[email protected]</a>)

我按照 grunt-init 安装说明进行操作,创建了 ~/.grunt-init/ 目录,并通过给定的命令克隆了 jquery 模板

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

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

最佳答案

看来您正在使用 OhMyZsh。您需要将 Grunt 文件添加到 $PATH 变量中。

cd 进入您的主目录并找到此文件 .zshrc 并查找带有

的行
export PATH=

并将其修改为:

export PATH="path_to_grunt:$PATH"

“:”用作多个路径的分隔符。

您可能正在寻找的内容在这里:

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

关于node.js - zsh:找不到命令:grunt-init,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29847949/

相关文章:

node.js - 如何使用 cryptoJS 或 Node 的默认加密为 AES 选择密码?

node.js - morgan 使用 Node js + Express 的文件旋转器流登录单独的 js

css - React 组件未显示在浏览器上

javascript - 警告 : flatten is not a function Use --force to continue

macos - 我收到此错误 "can' t 解压缩数据;在 MacOS 10.15 上安装 AWS EB CLI 时,zlib 不可用

vim - 终端 vim 未加载 .zshrc

node.js - Facebook "active access token must be used"

javascript - 为什么我的 Javascript 可以正常运行,但缩小后就不行了?

javascript - 在 Windows 中哪里可以找到 compass 的源文件?

rvm - zsh `which rvm` 或 `which gem` 返回函数内容而不是路径