I want to use Bower to install the client dependencies for my Bluemix project. It does not work if I simply run bower install
. I also tried to run it as a script by adding it to my package.json file as "postinstall": "bower install"
and then "prepublish": "bower install"
. but these do not work either. How can I make this work?
Asked
Active
Viewed 327 times
0

ralphearle
- 1,696
- 13
- 18
2 Answers
1
If you have devDependencies that Bower depends on, npm install
will not install them. As a workaround, you can move the required dependencies to the dependencies section of your package.son file, or you can run bower install
locally before pushing your app. (This may take longer because you will be uploading all the dependencies as well as your app.)
Another approach is to add another job at the beginning of your build:
- For "Builder type", select "Shell Script".
- Add the following under #!/bin/bash:
npm install node_modules/bower/bin/bower install
- Before running the new job, be sure that Bower is included in the dependencies list in your package.json file:
"dependencies": { "bower": 1.6.5,

ralphearle
- 1,696
- 13
- 18
0
- Move bower.json from /public to / (root level)
add bower as dependency in package.json
"dependencies": { ... "bower": "1.7.7" },
add a post install script in package.json as follows
"scripts": { ... "postinstall": "bower install" },
Create a file named .bowerrc and set the target folder for bower_components
{"directory": "public/bower_components"}
cf will run bower install after starting the application

Maho Garnica
- 25
- 7