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

Set OPEN_API_KEY failed #97

Closed i19s-leopold closed 1 year ago

i19s-leopold commented 1 year ago

I have tried to set my Open Api key:

opencommit config set OPEN_API_KEY=sk-**********************************
/.nvm/versions/node/v13.14.0/lib/node_modules/opencommit/out/cli.cjs:15050
    throw new Error(`${n} cannot contain ${h(r2?.[0])}`);
                                                                                 ^

SyntaxError: Unexpected token '.'
    at Object.compileFunction (vm.js:344:18)
    at wrapSafe (internal/modules/cjs/loader.js:1048:15)
    at Module._compile (internal/modules/cjs/loader.js:1082:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1138:10)
    at Module.load (internal/modules/cjs/loader.js:982:32)
    at Function.Module._load (internal/modules/cjs/loader.js:875:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
di-sukharev commented 1 year ago

try updating node to latest stable version

LucasMallmann commented 1 year ago

Also, according to the docs, the correct key would be OPENAI_API_KEY instead of OPEN_API_KEY. I'm not sure if this could be the cause of the error message, but it's worth checking.

i19s-leopold commented 1 year ago

My mistake it was due to the outdated version.