Installation

Raven is distributed in a few different methods, and should get included after any other libraries are included, but before your own scripts.

So for example:

<script src="jquery.js"></script>
<script src="https://cdn.ravenjs.com/3.16.0/raven.min.js" crossorigin="anonymous"></script>
<script>Raven.config('___PUBLIC_DSN___').install();</script>
<script src="app.js"></script>

This allows the ability for Raven’s integrations to instrument themselves. If included before something like Angular, it’d be impossible to use for example, the Angular plugin.

Using our CDN

We serve our own builds off of Fastly. They are accessible over both http and https, so we recommend leaving the protocol off.

Our CDN distributes builds with and without integrations.

<script src="https://cdn.ravenjs.com/3.16.0/raven.min.js" crossorigin="anonymous"></script>

This version does not include any plugins. See ravenjs.com for more information about plugins and getting other builds.

Bower

We also provide a way to deploy Raven via bower. Useful if you want serve your own scripts instead of depending on our CDN and mantain a bower.json with a list of dependencies and versions (adding the --save flag would automatically add it to bower.json).

$ bower install raven-js --save
<script src="/bower_components/raven-js/dist/raven.js"></script>

Also note that the file is uncompresed but is ready to pass to any decent JavaScript compressor like UglifyJS.

npm

Raven is also available as an npm package, raven-js.

$ npm install raven-js --save
<script src="/node_modules/raven-js/dist/raven.js"></script>

Note that if you intend to use Raven with Node, raven-node is the client to use.

CommonJS

To use Raven with CommonJS imports:

var Raven = require('raven-js') ;
Raven
    .config('___PUBLIC_DSN___')
    .install();

ES2015 (ES6)

To use Raven with ES2015 (ES6) imports:

import Raven from 'raven-js';
Raven
    .config('___PUBLIC_DSN___')
    .install();

Requirements

Raven supports IE8+ and all other modern browsers, and works in Web Workers.

Raven requires the browser JavaScript environment to provide:

Raven does not support IE 7 or other older browsers which do not provide the required features listed above. On those older browsers, Raven.js is designed to fail gracefully; including it on your page will have no effect, but it won’t collect and report uncaught exceptions.