di-sukharev / opencommit

Generate conventional git commit messages with AI in 1 second 🤯🔫
https://www.npmjs.com/package/opencommit
MIT License
5.98k stars 318 forks source link

Setting OPENAI_API_KEY throws an error : SyntaxError: Unexpected token '.' #65

Closed jossefaz closed 1 year ago

jossefaz commented 1 year ago

I followed the setup steps When I get to this step :

opencommit config set OPENAI_API_KEY=XXXXX

I get this error :

.nvm/versions/node/v12.13.0/lib/node_modules/opencommit/out/cli.cjs:15050
    throw new Error(`${n} cannot contain ${h(r2?.[0])}`);
                                                ^

SyntaxError: Unexpected token '.'
    at Module._compile (internal/modules/cjs/loader.js:892:18)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
    at internal/main/run_main_module.js:17:11

I tried to generate a new API key from OpenAI but it does the same.

MartinPaulEve commented 1 year ago

I had this bug which was fixed by upgrading my node version

jossefaz commented 1 year ago

@MartinPaulEve : Upgrading to lts (v18) indeed solved the issue. Thanks