Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bower_components created at wrong directory

Using Windows 7, Webstorm 10.0.1, current node.js, npm, bower, etc.

I created the default Webstorm AngularJS project, did not change anything and clicked "Run index.html". The page loaded but Angular was not running. From the source I saw that the files were missing <script src="bower_components/angular/angular.js"></script>. The directory bower_components was missing. Then I searched for it and it was created at C:\Users\<username>\bower_components whereas my Webstorm projects are under C:\Users\<username>\WebstormProjects\angularjs.

What configurations need to be changed to make my AngularJS app work?

Additional info:

.bowerrc

{
  "directory": "app/bower_components"
}

bower.json

{
  "name": "angular-seed",
  "description": "A starter project for AngularJS",
  "version": "0.0.0",
  "homepage": "https://github.com/angular/angular-seed",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "angular": "1.2.x",
    "angular-route": "1.2.x",
    "angular-loader": "1.2.x",
    "angular-mocks": "~1.2.x",
    "html5-boilerplate": "~4.3.0"
  }
}
like image 721
Shlomo Avatar asked Aug 21 '26 21:08

Shlomo


2 Answers

May be you are missing to install dependencies here.

In your project you have a bower.json file present. Go to that directory and run bower install command. This command will install all the specified dependencies of your project which is mentioned in bower.json

like image 198
Satyam Koyani Avatar answered Aug 24 '26 10:08

Satyam Koyani


You need to edit .bowerrc in the root of your project folder and set the directory you want to use:

{
  "directory" : "public/bower_components"
}

More info in Bower docs

like image 32
Kangcor Avatar answered Aug 24 '26 11:08

Kangcor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!