---
title: "Installation Methods"
description: "Review our alternate installation methods."
url: https://docs.sentry.io/platforms/javascript/guides/connect/install/
---

# Installation Methods | Sentry for Connect

* #### [CommonJS (CJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md)

  Learn about running Sentry in an CJS application.

* #### [ESM (MJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md)

  Learn about running Sentry in an ESM application.

* #### [ESM without CLI Flag](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm-without-import.md)

  Learn about running Sentry in an ESM application, without the --import flag.

* #### [Late Initialization (ESM or CJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/late-initialization.md)

  Learn about running Sentry in an ESM or CJS application, in scenarios where you cannot run init early.

* #### [Lightweight Mode](https://docs.sentry.io/platforms/javascript/guides/connect/install/lightweight.md)

  Learn about running Sentry in lightweight mode without OpenTelemetry, or with optional OTLP integration for existing OTel setups.

## [How To Decide Which Installation Method To Use](https://docs.sentry.io/platforms/javascript/guides/connect/install.md#how-to-decide-which-installation-method-to-use)

Most node applications today are either written in CommonJS (CJS), or compiled to CJS before running them. CommonJS uses `require()` to load modules. Our recommended installation method when using CommonJS is to require the `instrument.js` file at the top of your application. However, if your application is run in ESM mode, this will not work. In this case, you can follow the [ESM docs](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md).

Note that even if your application is written in ESM (using `import`), it may still be *run* in CJS. In this case, you should follow the [CommonJS instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md).

### [My application is in TypeScript](https://docs.sentry.io/platforms/javascript/guides/connect/install.md#my-application-is-in-typescript)

If you're using TypeScript, your application is likely compiled to CommonJS before running it. In this case, you should follow the [CommonJS instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md).

### [My application uses `require`](https://docs.sentry.io/platforms/javascript/guides/connect/install.md#my-application-uses-require)

If you are using `require()` in your application, you should follow the [CommonJS instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md).

### [My application uses `import`](https://docs.sentry.io/platforms/javascript/guides/connect/install.md#my-application-uses-import)

If you are using `import` in your application, your installation method depends on how your application is *run*. If you compile your application (e.g. into a `/dist` folder or similar) before running this, you need to check how the compiled code looks like. Is the compiled code using `require`? Then you should follow the [CommonJS instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md). If the compiled code is using `import`, you should follow the [ESM instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md).

If you do not compile your code, you'll need to follow the [ESM instructions](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md).

### [I don't need automatic spans/transactions](https://docs.sentry.io/platforms/javascript/guides/connect/install.md#i-dont-need-automatic-spanstransactions)

If you don't need spans emitted by OpenTelemetry instrumentation, you can use `@sentry/node-core` in [Lightweight Mode](https://docs.sentry.io/platforms/javascript/guides/connect/install/lightweight.md) without OpenTelemetry dependencies. You still get errors, logs, metrics, breadcrumbs, and more. This mode is experimental.

## Pages in this section

- [CommonJS (CJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/commonjs.md)
- [ESM (MJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm.md)
- [ESM (MJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm__v8.x.md)
- [ESM without CLI Flag](https://docs.sentry.io/platforms/javascript/guides/connect/install/esm-without-import.md)
- [Late Initialization (ESM or CJS)](https://docs.sentry.io/platforms/javascript/guides/connect/install/late-initialization.md)
- [Lightweight Mode](https://docs.sentry.io/platforms/javascript/guides/connect/install/lightweight.md)
