$ npm install @sentry/node
npm install @sentry/node
# Or yarn
yarn add @sentry/node
// CJS Syntax
const Sentry = require('@sentry/node');
// ESM Syntax
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: '__DSN__',
// ...
});
Note that it is necessary to initialize Sentry before you import any package that may be instrumented by us.
More information on how to set up Sentry for Node in v8.
Due to the way OpenTelemetry handles instrumentation, this only works out of the box for CommonJS (require
)
applications.
There is experimental support for running OpenTelemetry with ESM ("type": "module"
):
node --experimental-loader=@opentelemetry/instrumentation/hook.mjs ./app.js
You'll need to install @opentelemetry/instrumentation
in your app to ensure this works.
See OpenTelemetry Instrumentation Docs for details on this - but note that this is a) experimental, and b) does not work with all integrations.
© 2010 - cnpmjs.org x YWFE | Home | YWFE