[英]bower command not found
I tried to install twitter bower on my Mac, and I used我试图在我的 Mac 上安装 twitter bower,我用
npm install bower -g
Then I tried bower --help
, and the output was bower command not found
.然后我尝试了bower --help
,输出是bower command not found
。 Why is that?这是为什么?
Just like in this question ( npm global path prefix ) all you need is to set proper npm prefix
.就像在这个问题( npm 全局路径前缀)中一样,您只需要设置正确的npm prefix
。
UNIX: UNIX:
$ npm config set prefix /usr/local
$ npm install -g bower
$ which bower
>> /usr/local/bin/bower
Windows ans NVM: Windows 和 NVM:
$ npm config set prefix /c/Users/xxxxxxx/AppData/Roaming/nvm/v8.9.2
$ npm install -g bower
Then bower
should be located just in your $PATH
.然后bower
应该位于您的$PATH
。
I am almost sure you are not actually getting it installed correctly.我几乎可以肯定您实际上并没有正确安装它。 Since you are trying to install it globally, you will need to run it with sudo:由于您尝试全局安装它,因此您需要使用 sudo 运行它:
sudo npm install -g bower
另外,您也可以使用npx
与故宫> 5.6走来。
npx bower install
This turned out to NOT be a bower problem, though it showed up for me with bower.结果证明这不是凉亭问题,尽管它出现在凉亭中。
It seems to be a node-which problem.这似乎是一个节点问题。 If a file is in the path, but has the setuid/setgid bit set, which will not find it.如果文件在路径中,但设置了 setuid/setgid 位,则不会找到它。
Here is a files with the s bit set: (unix 'which' will find it with no problems).这是一个设置了 s 位的文件:(unix 'which' 可以毫无问题地找到它)。
ls -al /usr/local/bin -rwxrwsr-- 110 root nmt 5535636 Jul 17 2012 git ls -al /usr/local/bin -rwxrwsr-- 110 根 nmt 5535636 2012 年 7 月 17 日 git
Here is a node-which attempt:这是一个 node-which 尝试:
> which.sync('git')
Error: not found: git
I change the permissions (chomd 755 git).我更改了权限(chomd 755 git)。 Now node-which can find it.现在 node-which 可以找到它。
> which.sync('git')
'/usr/local/bin/git'
Hope this helps.希望这可以帮助。
I am using node version manager.我正在使用节点版本管理器。 I was getting this error message because I had switched to a different version of node.我收到此错误消息是因为我已切换到不同版本的节点。 When I switched back to the version of node where I installed bower, this error went away.当我切换回安装 bower 的节点版本时,此错误消失了。 In my case, the command was nvm use stable
就我而言,命令是nvm use stable
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.