patrikzudel / PatrikZeros-ChatGPT-API-UI

Static webpage that allows you to use your OpenAI API key for the same experience as you get with ChatGPT!
https://chat.patrikzudel.me
GNU General Public License v3.0
510 stars 100 forks source link

Can't run the app locally with the provided command, throws error #22

Closed sachit-menon closed 1 year ago

sachit-menon commented 1 year ago

Describe the bug Can't run the app locally with the provided command, throws error

To Reproduce Steps to reproduce the behavior:

  1. Clone the repo
  2. cd inside
  3. npm run dev

Expected behavior A clear and concise description of what you expected to happen. The app to start running locally

Screenshots If applicable, add screenshots to help explain your problem.

> patriks-chatgpt-implementation@0.0.0 dev /Users/sachit/Documents/Documents - Sachit’s MacBook Pro/Misc/Code/PatrikZeros-ChatGPT-API-UI
> vite

internal/modules/cjs/loader.js:1172
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

0 info it worked if it ends with ok
3 info using node@v12.16.2
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/sachit/Documents/Documents - Sachit’s MacBook Pro/Misc/Code/PatrikZeros-ChatGPT-API-UI/node_modules/vite/bin/vite.js
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1172:13)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'ERR_REQUIRE_ESM'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! patriks-chatgpt-implementation@0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the patriks-chatgpt-implementation@0.0.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!     /Users/sachit/.npm/_logs/2023-03-18T06_58_22_195Z-debug.log

Desktop (please complete the following information):

derekperrin commented 1 year ago

I had a similar problem. Updating from node v12 to v18 fixed it.

sachit-menon commented 1 year ago

thanks so much, that did the trick!