askrella / whatsapp-chatgpt

ChatGPT + DALL-E + WhatsApp = AI Assistant :rocket: :robot:
3.49k stars 842 forks source link

Error Cannot find module utils.js #306

Closed Insan23 closed 1 year ago

Insan23 commented 1 year ago

when trying to execute npm run start, the following error occurs

PS C:\Users\Default\git\whatsapp-chatgpt> npm run start

> whatsapp-chatgpt@1.0.0 start
> npx vite-node src/index.ts

node:internal/modules/cjs/loader:956
  const err = new Error(message);
              ^

Error: Cannot find module './utils.js'
Require stack:
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatwg-url\lib\URL.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatwg-url\lib\public-api.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\node-fetch\lib\index.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\structures\MessageMedia.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\structures\Message.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\structures\Chat.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\structures\PrivateChat.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\factories\ChatFactory.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\src\Client.js
- C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatsapp-web.js\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1022:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\Default\git\whatsapp-chatgpt\node_modules\whatwg-url\lib\URL.js:4:15)
    at Module._compile (node:internal/modules/cjs/loader:1120:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
    at Module.load (node:internal/modules/cjs/loader:998:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Module.require (node:internal/modules/cjs/loader:1022:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatwg-url\\lib\\URL.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatwg-url\\lib\\public-api.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\node-fetch\\lib\\index.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\structures\\MessageMedia.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\structures\\Message.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\structures\\Chat.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\structures\\PrivateChat.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\factories\\ChatFactory.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\src\\Client.js',
    'C:\\Users\\Default\\git\\whatsapp-chatgpt\\node_modules\\whatsapp-web.js\\index.js'
  ]
}

I've already following the step from here, filling some required field in .env file, but it seems that the program cannot read the src/utils.js (?) is there any common steps not written on the guide that I miss?

Running on powershell windows 10 22H2 64bit Node.js v18.6.0

navopw commented 1 year ago

Delete the node_modules directory Delete the package-lock.json file Run npm install Run npm start