question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot redeclare block-scoped variable '__DEBUG_BUILD__'

See original GitHub issue

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version?

@sentry/angular: ^7.11.0
@sentry/capacitor: ^0.9.0

Ionic:

   Ionic Framework               : @ionic/angular 5.9.1
   @angular-devkit/build-angular : 0.1102.6
   @angular-devkit/schematics    : 11.2.7
   @angular/cli                  : 11.2.6
   @ionic/angular-toolkit        : 2.3.3

Capacitor:

   Capacitor CLI      : 3.3.2
   @capacitor/android : 3.3.2
   @capacitor/core    : 3.3.2
   @capacitor/ios     : 3.3.2

Steps to Reproduce

We’ve never used @sentry/capacitor and always used @sentry/angular for web only. I tried to implement @sentry/capacitor after having upgraded to Capacitor 3. However, when trying to build the mobile apps (Android/iOS) I get the following errors:

Error: node_modules/@sentry/capacitor/node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.
const __DEBUG_BUILD__: boolean;
node_modules/@sentry/types/types/globals.d.ts:2:11
const __DEBUG_BUILD__: boolean;
'__DEBUG_BUILD__' was also declared here.

Error: node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.
const __DEBUG_BUILD__: boolean;
node_modules/@sentry/capacitor/node_modules/@sentry/types/types/globals.d.ts:2:11
const __DEBUG_BUILD__: boolean;
'__DEBUG_BUILD__' was also declared here.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8

github_iconTop GitHub Comments

3reactions
lucas-zimermancommented, Sep 1, 2022

I am also facing this problem, seems to be because the latest version ( 0.9.0 ) of @sentry/capacitor depends on @sentry/types 7.8.1 and the latest version of @sentry/angular (7.12.0) depends on @sentry/types 7.12.0 . This causes npm to not consolidate the dependencies and thus resulting in the error.

mmm if so I’ll bump the dependencies version this week.

2reactions
mmjr-xcommented, Sep 1, 2022

Although the @sentry/types is the only one that causes a hard error, the following (peer)deps should probably be bumped to 7.12.0 as well:

Besides that “@sentry/wizard” and “@sentry/typescript” might need to be bumped as well (although I am not 100% sure about this)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot redeclare block scoped variable - Stack Overflow
It happens when variable co is already defined in the scope (maybe window/global object has it) and you ...
Read more >
[SOLVED] Cannot Redeclare Block-Scoped Variable in ...
The “Cannot redeclare block-scoped variable” error occurs if you declare a variable with a name that clashes with one declared in TypeScript ...
Read more >
TypeScript and the Error: Cannot Redeclare Block Scoped ...
Hi, Devs! Who are getting start in Typescript could face this error: "Cannot Redeclare Block Scoped Variable Name" and it means a concept ......
Read more >
TS2451: Cannot redeclare block-scoped variable · Issue #249
Error: node_modules/@sentry/types/types/globals.d.ts:2:11 - error TS2451: Cannot redeclare block-scoped variable '__DEBUG_BUILD__'.
Read more >
Cannot redeclare block-scoped variable? How to resolve
Cannot redeclare block -scoped variable? The Reason behind the error and the way to resolve it.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found