问题
I am trying to use bower inside Visual Studio 2013.
First I installed bower (not bower.js) via nuget's Package Manager Console.
Then I thought I could simply type
PM> bower init
inside the PMC to generate the bower.json.
But then it gave me this error.
bower : The term 'bower' is not recognized...
PS. The path of the PM>
is pointing to C:\MyWebProject\MyWebProject\.bin
.
What am I missing here??
回答1:
- Open the command prompt
- Navigate to web project folder
- Run bower init
- You should have bower.json created by answering all answers on the cmd prompt.
回答2:
Srinivas accurately described the steps needed to get you started with a bower.json
in your root folder, which is where you want to start. You now have two main tasks:
- Define dependencies - use Package Intellisense.
- Install dependencies - use Grunt Launcher. They will be installed to the
bower_components
folder. - Reference dependencies - simply add them to you project (as links).
For more information see Introducing Gulp, Grunt, Bower, and npm support for Visual Studio.
Note that Visual Studio 2015 (currently in preview) has built-in, first-class support for all of the above: Manage Client-Side Web Development in Visual Studio 2015, Using Grunt and Bower.
来源:https://stackoverflow.com/questions/26521889/how-to-use-bower-installed-from-nuget-in-visual-studio