uport-project / uport-cli-client

Minimal command-line based uPort client
Apache License 2.0
19 stars 5 forks source link

Spread Operator Throws "Unexpected token ..." in Node 8.1.0 #2

Closed kamescg closed 6 years ago

kamescg commented 6 years ago

Just ran npm install --global uport-cli-client - might be to early still?

When I run the uport-id command in the CLI I get an error for the spread operator.

uport uport-id create
/Users/kamescg/.nvm/versions/node/v8.1.0/lib/node_modules/uport-cli-client/node_modules/uport-client/index.js:389
    const payload = {...info, iss: this.address, iat: new Date().getTime(), verified, type: 'shareReq', req}
                     ^^^

SyntaxError: Unexpected token ...
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/kamescg/.nvm/versions/node/v8.1.0/lib/node_modules/uport-cli-client/uport-id.js:2:21)
zachferland commented 6 years ago

@KamesCG thanks for the issue! yeah it seems the object spread operator was not supported in node until 8.2.1 (with flag, and then 8.6.0). To try it right now, run a greater version of node, and in the future we will update uport-js-client to transpile the src for wider node version support.

kamescg commented 6 years ago

Thank you @zachferland

Updated my local Node version (using node version manager- nvm) running the command

nvm install 9.7.1