javascript 当 .bowerrc 存在时,Bower 不会安装软件包

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20343003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 18:16:24  来源:igfitidea点击:

Bower will not install packages when .bowerrc exists

javascriptbower

提问by Sparragus

I'm trying to install packages using Bower.

我正在尝试使用 Bower 安装软件包。

Without a .bowerrc file, it works. For example, bower install angular#1.0.6will install nicely inside ./bower_components.

没有 .bowerrc 文件,它就可以工作。例如,bower install angular#1.0.6将很好地安装在./bower_components.

If there is a .bowerrc with { 'directory' : 'public/javascripts/vendor' }, bower install angular#1.0.6will not work. Actually, the output of that command is nothing. It simply prints a blank line, then the next line is my terminal prompt. The package is not installed anywhere.

如果有 .bowerrc 和{ 'directory' : 'public/javascripts/vendor' },bower install angular#1.0.6将不起作用。实际上,该命令的输出什么都不是。它只是打印一个空行,然后下一行是我的终端提示。该软件包未安装在任何地方。

However, if there is an empty .bowerrc file, it will install the package inside ./bower_components.

但是,如果有一个空的 .bowerrc 文件,它会在 ./bower_components 中安装包。

Why is it not installing the packages and how can I fix it? (so they will install)

为什么不安装软件包,我该如何解决?(所以他们会安装)

Additional info:

附加信息:

No bower command works. bowerwill fail similarly. bower helptoo. In fact, bower anythingwill too.

没有凉亭命令有效。bower同样会失败。bower help也。其实bower anything也会。

回答by Sparragus

I just solved this. I uninstalled and reinstalled bower, and now it works. :S

我刚刚解决了这个问题。我卸载并重新安装了 bower,现在它可以工作了。:S

sudo npm rm -g bower

sudo npm rm -g bower

sudo npm install bower -g

sudo npm install bower -g

Now everything works fine!

现在一切正常!

回答by Jesse Seaver

The solution here is simple :

这里的解决方案很简单:

  1. Install Bower in your public directory ( Not your app/node master directory ) For example, mynodeapp/public - npm install bower

  2. Then, set up bower from this directory : bower init

  3. Create your .bowercc file, and add to it : { "directory" : "vendor" } //Where vendor is your custom fldr

  4. Thats it. Now whenever you run a bower install command from within the public directory, it will either create or save to that "vendor" directory.

  1. 在您的公共目录(不是您的应用程序/节点主目录)中安装 Bower 例如, mynodeapp/public - npm install bower

  2. 然后,从此目录设置凉亭: bower init

  3. 创建您的 .bowercc 文件,并在其中添加: { "directory" : "vendor" } //vendor 是您的自定义 fldr

  4. 而已。现在,无论何时从公共目录中运行 bower install 命令,它都会创建或保存到该“供应商”目录。

Everyone seems to have trouble because they are installing Bower outside their public folder.

每个人似乎都遇到了麻烦,因为他们在公用文件夹之外安装 Bower。

回答by PURVESH PATEL

Try to run with -f flag (force)

尝试使用 -f 标志运行(强制)

bower -f install

bower -f install

回答by Ajay

I think that you should be reinstall the bower

我认为你应该重新安装凉亭

npm rm -g bower
npm install bower -g