Skip to content

Conversation

@ar4mirez
Copy link

@ar4mirez ar4mirez commented Jul 4, 2025

Summary

Fixes the syntax error that was preventing [email protected] from running.

Problem

The published version 0.5.1 had a syntax error where a catch block was misplaced inside an if statement without a corresponding try block:

SyntaxError: Unexpected token 'catch' at line 208

Root Cause

The issue was caused by incorrect try-catch block structure:

  • A try block started at line 155 outside the if (isPreview) statement
  • A catch block was incorrectly placed inside the if (isPreview) block at line 208
  • This created an orphaned catch block without a matching try

Solution

  • Moved the catch block outside the if (isPreview) scope to properly match the try block
  • Updated version to 0.5.1 to match the published version
  • Verified syntax with node -c index.js
  • Tested functionality with node index.js --help

Test Plan

  • Syntax check passes: node -c index.js
  • Help command works: node index.js --help
  • No syntax errors in console

Fixes

Closes #1

Files Changed

  • index.js: Fixed try-catch block structure
  • package.json: Updated version to 0.5.1

- Fixed misplaced catch block that was inside if statement
- Moved catch block outside of if (isPreview) scope to match try block
- Updated version to 0.5.1 to match published version
- Resolves SyntaxError: Unexpected token 'catch' at line 208

Fixes Helmi#1
@ahead-kellan
Copy link

I am going to +1 this. I am on Node 24.3

/hello-simone/index.js:208
    } catch (error) {
      ^^^^^

SyntaxError: Unexpected token 'catch'
    at compileSourceTextModule (node:internal/modules/esm/utils:351:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
    at #translate (node:internal/modules/esm/loader:546:12)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:593:27)
    at async #link (node:internal/modules/esm/module_job:173:19)

Node.js v24.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix: SyntaxError with try-catch block at line 208

2 participants