Skip to content

Package Management

Priya Angara edited this page Dec 15, 2017 · 18 revisions

Project dependencies need to get updated from time to time. Here are some helpful tips if you're planning to take up this daunting task.

Note

Upgrading the entire package.json to the latest versions in one go is not a good idea as it breaks a lot of things. A better approach is to do a slow roll-out. Update packages in chunks of ~5 at a time so that it is easier to localize the source of the error.

node, npm and yarn versions

  • Make sure you have the same versions of node/yarn as dev/test/prod ** Go to the openshift console, look for the project > terminal ** Run node -v, yarn -version (also npm -version in case you're using npm) to figure out the current version being used.

Upgrading versions in package.json

  • Dependencies required by the application are referenced here
  • Dependencies are installed in the node_modules/ folder
  • Run yarn install to install all the dependencies
  • [Optional] Clean out node_modules/ before running yarn install if you see errors

Packages to look out for

  1. csv-parse
  2. All grunt-* packages
  3. nodemailer
  4. multer

Upgrading these packages on local might not give you errors but fails when Jenkins triggers a build.

Exiting "Trigger OpenShift Build" unsuccessfully; build "mem-mmt-build-x" did not complete successfully within the configured timeout of "1200000" ms; last reported status:  [Failed].

error: build error: non-zero (13) exit code from registry.access.redhat.com

Errors that look like this usually mean jenkins did not like some package(s), the details of which we never get to know. Therefore, do this.

Upgrading versions in bower.json

  • Dependencies required by the front-end are referenced here
  • Dependencies are installed in the public/lib/ folder
  • Run bower install to install all the dependencies
  • [Optional] Clean out public/lib/ before running bower install if you see errors

Packages to look out for

  1. angular-mocks
  2. angular-cookies
  3. angular-bootstrap
  4. angular-ui-utils: 'bower' - don't change this.
  5. lodash - might break a lot of code.

Angular-sanitize errors

You might have noticed the angular-sanitize errors on your chrome/firefox console. This can be fixed by making sure all angular-* versions point to 1.6.7. Doing that will kill the application (because of the packages listed above), and therefore, for now, we have to live with it.

npm -> yarn

bower -> yarn (TODO)