claabs / markov-discord

A Markov chain Discord chat bot. Generates unique messages by learning from past messages. Also occasionally attaches images to messages.
76 stars 20 forks source link

program not creating config file #29

Open YungFrag opened 2 years ago

YungFrag commented 2 years ago

im literally brand new to trying stuff like this so im about as lost as i possibly can be.

Error: Invalid config 04:50:23 0|index | at Object. (C:\Users\yungf\markov-discord\src\config\setup.ts:73:9) 04:50:23 0|index | at Module._compile (node:internal/modules/cjs/loader:1103:14) 04:50:23 0|index | at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10) 04:50:23 0|index | at Module.load (node:internal/modules/cjs/loader:981:32) 04:50:23 0|index | at Function.Module._load (node:internal/modules/cjs/loader:822:12) 04:50:23 0|index | at Module.require (node:internal/modules/cjs/loader:1005:19) 04:50:23 0|index | at Module.Hook._require.Module.require (C:\Users\yungf\markov-discord\node_modules\require-in-the-middle\index.js:80:39) 04:50:23 0|index | at require (node:internal/modules/cjs/helpers:102:18) 04:50:23 0|index | at Object. (C:\Users\yungf\markov-discord\src\config\index.ts:2:1) 04:50:23 0|index | at Module._compile (node:internal/modules/cjs/loader:1103:14) 04:50:23 0|index | [2022-02-18 04:50:22.990 -0600] WARN: No config file detected 2022-02-18T04:50:23: PM2 log: App [index:0] exited with code [1] via signal [SIGINT] 04:50:23 PM2 | App [index:0] exited with code [1] via signal [SIGINT] 2022-02-18T04:50:23: PM2 log: App [index:0] starting in -fork mode- 04:50:23 PM2 | App [index:0] starting in -fork mode- 2022-02-18T04:50:23: PM2 log: App [index:0] online 04:50:23 PM2 | App [index:0] online

claabs commented 2 years ago

The config file validation error should log right after the WARN: No config file detected.

Here are my logs, running in PM2 without a config file:

$ npm start

> markov-discord@2.0.2 start
> NODE_ENV=production pm2 start --no-daemon dist/index.js

pm2 launched in no-daemon mode (you can add DEBUG="*" env variable to get more messages)
2022-02-20T18:18:05: PM2 log: Launching in no daemon mode
2022-02-20T18:18:05: PM2 log: [PM2] Starting /home/charl/projects/markov-discord/dist/index.js in fork_mode (1 instance)
2022-02-20T18:18:05: PM2 log: App [index:0] starting in -fork mode-
2022-02-20T18:18:05: PM2 log: App [index:0] online
2022-02-20T18:18:05: PM2 log: [PM2] Done.
2022-02-20T18:18:05: PM2 log: ┌─────┬──────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name     │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼──────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ index    │ default     │ 2.0.2   │ fork    │ 16516    │ 0s     │ 0    │ online    │ 0%       │ 32.9mb   │ charl    │ disabled │
└─────┴──────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
2022-02-20T18:18:05: PM2 log: [--no-daemon] Continue to stream logs
2022-02-20T18:18:05: PM2 log: [--no-daemon] Exit on target PM2 exit pid=16505
18:18:06 0|index  | Error: Invalid config
18:18:06 0|index  |     at Object.<anonymous> (/home/charl/projects/markov-discord/src/config/setup.ts:73:9)
18:18:06 0|index  |     at Module._compile (node:internal/modules/cjs/loader:1101:14)
18:18:06 0|index  |     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
18:18:06 0|index  |     at Module.load (node:internal/modules/cjs/loader:981:32)
18:18:06 0|index  |     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
18:18:06 0|index  |     at Module.require (node:internal/modules/cjs/loader:1005:19)
18:18:06 0|index  |     at Module.Hook._require.Module.require (/home/charl/projects/markov-discord/node_modules/require-in-the-middle/index.js:80:39)
18:18:06 0|index  |     at require (node:internal/modules/cjs/helpers:102:18)
18:18:06 0|index  |     at Object.<anonymous> (/home/charl/projects/markov-discord/src/config/index.ts:2:1)
18:18:06 0|index  |     at Module._compile (node:internal/modules/cjs/loader:1101:14)
18:18:06 0|index  | [2022-02-20 18:18:06.352 -0600] WARN: No config file detected
18:18:06 0|index  | [2022-02-20 18:18:06.353 -0600] INFO: Wrote new default config file
18:18:06 0|index  |     newConfigPath: "/home/charl/projects/markov-discord/config/config.json"
18:18:06 0|index  | [2022-02-20 18:18:06.355 -0600] ERROR: Validation error(s)
18:18:06 0|index  |     errors: [
18:18:06 0|index  |       {
18:18:06 0|index  |         "value": "",
18:18:06 0|index  |         "property": "token",
18:18:06 0|index  |         "children": [],
18:18:06 0|index  |         "constraints": {
18:18:06 0|index  |           "isNotEmpty": "token should not be empty"
18:18:06 0|index  |         }
18:18:06 0|index  |       }
18:18:06 0|index  |     ]
2022-02-20T18:18:06: PM2 log: App [index:0] exited with code [1] via signal [SIGINT]
18:18:06 PM2      | App [index:0] exited with code [1] via signal [SIGINT]
2022-02-20T18:18:06: PM2 log: App [index:0] starting in -fork mode-
18:18:06 PM2      | App [index:0] starting in -fork mode-
2022-02-20T18:18:06: PM2 log: App [index:0] online
18:18:06 PM2      | App [index:0] online

There's not much more I can gather from your logs.

ghost commented 2 years ago

I had this problem when I ran the bot on Linux. I just had to create the config folder beforehand.

ghost commented 5 months ago

I'm having the same problem on Windows. Ever find a fix?