winston-transport-sentry-node icon indicating copy to clipboard operation
winston-transport-sentry-node copied to clipboard

Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

Open spg opened this issue 2 years ago • 0 comments

When building my project, I get the following error:

yarn run v1.22.19
$ tsc
node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

2     const __DEBUG_BUILD__: boolean;
            ~~~~~~~~~~~~~~~

  node_modules/winston-transport-sentry-node/node_modules/@sentry/types/types/globals.d.ts:2:11
    2     const __DEBUG_BUILD__: boolean;
                ~~~~~~~~~~~~~~~
    '__DEBUG_BUILD__' was also declared here.

node_modules/winston-transport-sentry-node/node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.

2     const __DEBUG_BUILD__: boolean;
            ~~~~~~~~~~~~~~~

  node_modules/@sentry/types/types/globals.d.ts:2:11
    2     const __DEBUG_BUILD__: boolean;
                ~~~~~~~~~~~~~~~
    '__DEBUG_BUILD__' was also declared here.


Found 2 errors.

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

In my package.json, I have 2 Sentry-related dependencies:

...
    "@sentry/node": "7.14.2",
    "winston-transport-sentry-node": "2.6.0",
...

I looked at winston-transport-sentry-node's dependencies, and it seems like it has a direct dependency on @sentry/node: https://github.com/aandrewww/winston-transport-sentry-node/blob/master/package.json#L38

Suggestion: @sentry/node should be included as a peerDependencies instead of a regular dependencies

Temporary fix: I had to remove my dependency on @sentry/node from my project. However, now I'm stuck with the @sentry/node version that is provided by winston-transport-sentry-node

spg avatar Oct 07 '22 13:10 spg