Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node exception: syntax error in argparse.js: "syntax error: unexpected token {" #158

Closed
theotherothermatt opened this issue Dec 16, 2020 · 1 comment

Comments

@theotherothermatt
Copy link

While trying to set up Cloudsploit scanner in Azure VM, am presented with this error on run:

azureuser@cloudsploit-master:~/scans$ ./index.js -h
/home/azureuser/scans/node_modules/argparse/argparse.js:222
    } catch {}
            ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/azureuser/scans/index.js:3:28)

The block of code in question:

function _alias(object, from, to) {
    try {
        let name = object.constructor.name
        Object.defineProperty(object, from, {
            value: util.deprecate(object[to], sub('%s.%s() is renamed to %s.%s()',
                name, from, name, to)),
            enumerable: false
        })
    } catch {}
}

I am not a developer, but it seems to me that the "catch" is missing the variable to catch. On this assumption, I changed the catch to

   } catch (exp) {}
}

And was then able to view the usage information as expected.

OS: Ubuntu 18.04
Node version: v8.10.0
NPM version: 3.5.2

@puzrin
Copy link
Member

puzrin commented Dec 16, 2020

Node v10+ required, as been said in changelog.

@puzrin puzrin closed this as completed Dec 16, 2020
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

No branches or pull requests

2 participants