whatsapp-chatgpt icon indicating copy to clipboard operation
whatsapp-chatgpt copied to clipboard

Fail to run "npm run start"

Open DannyLI0319 opened this issue 2 years ago • 4 comments

I got the error below, anyone can help?

[email protected] start C:\Users\kuang\Desktop\WhatsApp_ChatGPT npx vite-node src/index.ts

npm WARN config cache-max This option has been deprecated in favor of --prefer-online npm WARN config cache-min This option has been deprecated in favor of --prefer-offline. npm WARN config optional Use --omit=optional to exclude optional dependencies, or npm WARN config --include=optional to include them. npm WARN config npm WARN config Default value does install optional deps unless otherwise omitted. npm WARN config shrinkwrap Use the --package-lock setting instead. npm WARN config tmp This setting is no longer used. npm stores temporary files in a special npm WARN config location in the cache, and they are managed by npm WARN config cacache. npm ERR! code ENOLOCAL npm ERR! Could not install from "Files\nodejs\node_cache_npx\12112" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Program Files\nodejs\node_cache_logs\2023-02-08T15_47_41_230Z-debug.log Install for [ 'vite-node@latest' ] failed with code 1 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] start: npx vite-node src/index.ts npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] start 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! C:\Program Files\nodejs\node_cache_logs\2023-02-08T15_47_41_327Z-debug.log

DannyLI0319 avatar Feb 08 '23 15:02 DannyLI0319

Did you run npm install before npm run start?

navopw avatar Feb 16 '23 18:02 navopw

Tried to install vite-node, but failed with this command - npm install vite-node

sharp0111 avatar Feb 19 '23 00:02 sharp0111

@sharp0111 could you provide what npm logs when you run npm install?

marcomafessolli avatar Feb 19 '23 10:02 marcomafessolli

from OP message npm ERR! This is probably not a problem with npm. There is likely additional logging output above. it seems to be happened due to a network problem.

Zain-ul-din avatar Feb 19 '23 17:02 Zain-ul-din

➜ whatsapp-chatgpt git:(master) npm run start

[email protected] start npx vite-node src/index.ts

file://whatsapp-chatgpt/node_modules/chatgpt/build/index.js:132 throw new Error("Invalid environment; fetch is not defined");

sharp0111 avatar Feb 19 '23 19:02 sharp0111

➜ whatsapp-chatgpt git:(master) npm run start

[email protected] start npx vite-node src/index.ts

file://whatsapp-chatgpt/node_modules/chatgpt/build/index.js:132 throw new Error("Invalid environment; fetch is not defined");

Whats your node version?

If fetch is not defined, its mostly because you're using node <= v18

navopw avatar Feb 19 '23 19:02 navopw

I use node v16. I'll try a later version. Thanks.

sharp0111 avatar Feb 19 '23 19:02 sharp0111

Thank you, with 18+ it will work for sure :)

navopw avatar Feb 19 '23 21:02 navopw