/usr/local/share/npm/lib/no-6ren">
gpt4 book ai didi

node.js - Bower:安装后 "command not found"

转载 作者:IT老高 更新时间:2023-10-28 21:54:20 26 4
gpt4 key购买 nike

当我执行 npm install bower -g

时,我似乎得到了以下信息
/usr/local/share/npm/bin/bower -> /usr/local/share/npm/lib/node_modules/bower/bin/bower
bower@0.8.6 /usr/local/share/npm/lib/node_modules/bower

不幸的是,执行任何 bower 命令都会返回 -bash: bower: command not found

which npm 返回 /usr/local/bin/npm 并运行 which node 返回 /usr/local/bin/Node .

最佳答案

我假设您通过 Homebrew 安装了 Node.js,这很烦人地将安装的 npm 二进制文件放在通常不在用户路径中的位置。您所要做的就是将 /usr/local/share/npm/bin 添加到您的 $PATH 中。您可以通过将 export PATH=/usr/local/share/npm/bin:$PATH 添加到您的 .bashrc/.bash_profile/.zshrc 文件中来做到这一点。

虽然我宁愿卸载 Homebrew 安装的 Node.js 并使用来自 nodejs.org 的安装程序安装它没有这个问题。

这个问题不是 Bower 特有的,并且在任何全局安装的 Node.js 二进制文件中都会很明显,例如。 grunt、uglify、jshint 等。

关于node.js - Bower:安装后 "command not found",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15846076/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com