Skip to content

CLI fails to start because bin/lunkcrypt has a syntax error #1

@MrDiscipline

Description

@MrDiscipline

Reproduction

From a clean npm project:

tmp=$(mktemp -d)
cd "$tmp"
npm init -y >/dev/null
npm install --no-audit --no-fund lunkcrypt@1.0.3
./node_modules/.bin/lunk --help

Actual behavior

The CLI fails during module loading before Commander can print help:

node_modules/lunkcrypt/bin/lunkcrypt:4
var file                =  require('../lib/file');
^^^

SyntaxError: Unexpected token 'var'

The same happens for lunk --version and any other invocation.

Expected behavior

The CLI should load successfully so lunk --help and lunk --version can run.

Root cause

bin/lunkcrypt starts a comma-separated var declaration on line 3, but line 4 starts a new var statement instead of continuing the declaration or ending the previous line with a semicolon:

var generatePassword    =  require('../lib/generatePassword'),
var file                =  require('../lib/file');

Fix pointer

Changing the trailing comma on the first declaration to a semicolon fixes the syntax error.

I verified the fix by packing the branch, installing the tarball into a clean npm project, and running:

./node_modules/.bin/lunk --help
./node_modules/.bin/lunk --version

Both commands exit 0 after the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions