Node.js/npm scripts

Report builds to Bugsnag using a JS API or Node-based CLI

Use our tool to:

  • Report information when you build your app to enable linking to code in your source control provider from the releases dashboard, timeline annotations, and stack traces.

If you are using any of the following tools in your build, you may find the following guides more convenient: Webpack, Grunt or Gulp.


Install the bugsnag-build-reporter tool.

npm install --save-dev bugsnag-build-reporter

Reporting builds

bugsnag-build-reporter can auto detect source control info from .git, .hg and package.json. For detailed usage instructions, check out the readme. Here are some examples to get you started:

Setting appVersion

There are a variety of ways to manage or inject version numbers in your build, so the following advice applies to whichever strategy you use.

  • Set appVersion in your notifier so that sessions and error reports are correctly associated with your reported builds
  • Keep the notifier appVersion in sync with the build reporter
  • appVersion should change any time your source code, or any of its dependencies changes


If your application builds in a Node environment, you can import the JS API and use it like so:

const reportBuild = require('bugsnag-build-reporter')
reportBuild({ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3' }, { /* opts */ })
  .then(() => console.log('success!'))
  .catch(err => console.log('fail', err.messsage))


npm scripts

scripts: {
  "report-build": "bugsnag-build-reporter -k YOUR_API_KEY -v '1.2.3' -n 'Katherine Johnson'"


PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash

    bugsnag-build-reporter -k YOUR_API_KEY -v "1.2.3" -n "Katherine Johnson"

Uploading source maps

Support for uploading source maps is coming soon. Until then please see our source map support guide.