Possible to run bower & npm on Travis-initiated bu

2019-06-21 17:34发布

问题:

I have a project that I'm hosting at GitHub (https://github.com/njacobs5074/InOutBoard) that runs the npm and bower commands from Maven as part of the build. This is done to ensure that the proper JavaScript packages are installed - my project is a Java web app with a JavaScript front-end.

Obviously this works fine on my dev box since I have these commands installed an in my PATH. Just not clear on how to get this working with Travis.

Thanks much,

Nick

回答1:

Every Travis worker has a node.js runtime and NPM installed, so you can use it to install Bower.
In order to install Bower and run bower install add the following to .travis.yml:

before_script:
  - npm install -g bower
  - bower install