Error to run openai-quickstart-node

Hi, I try to run the sample code in node, but I find this ERROR. Anyone have the solution? Thanks!

vini@Notebook_Vini:~/openai/openai-quickstart-node-master$ npm run dev

openai-quickstart-node@0.1.0 dev /home/vini/openai/openai-quickstart-node-master
next dev

showAll: args[“–show-all”] ?? false,

SyntaxError: Unexpected token ?
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at (/home/vini/openai/openai-quickstart-node-master/node_modules/next/dist/lib/commands.js:10:30)
at Object. (/home/vini/openai/openai-quickstart-node-master/node_modules/next/dist/bin/next:141:28)
at Module._compile (internal/modules/cjs/loader.js:778:30)
npm ERR! errno 1
npm ERR! openai-quickstart-node@0.1.0 dev: next dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the openai-quickstart-node@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/vini/.npm/_logs/2023-01-12T21_07_25_017Z-debug.log

Hi, i’ve the same error with node version v12.18.3
try with v18, it’s ok for me

probably you need to install “next”
in this case exec in shell command “npm install next”

i hope i was helpful

Does not work either at my side.

I had the same error and was able to fix by installing the latest node. v18 worked for me (since I’m on windows, I did have to go toe the node website and get the latest version there)

1 Like


you need to update your node version because you have an old one.

To fix it, just run: npm install node