towfiqi / serpbear

Search Engine Position Rank Tracking App
https://docs.serpbear.com/
MIT License
1.45k stars 146 forks source link

Error Encountered by Cron Process Due to Missing settings.json File #211

Closed AntoineKM closed 2 weeks ago

AntoineKM commented 6 months ago

Issue Description: When running the npm run start:all command in the project, the cron process encounters an error related to a missing file or directory: settings.json. This error disrupts the execution of the cron task.

Error Message:

node:internal/process/promises:288
        triggerUncaughtException(err, true /* fromPromise */);
        ^
[Error: ENOENT: no such file or directory, open './data/settings.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: './data/settings.json'
}

Steps to Reproduce: https://docs.serpbear.com/deployment/running-serpbear-locally

Expected Behavior: The cron task should run without errors and successfully access the settings.json file.

Additional Context:

Possible Solution: Ensure that the settings.json file exists in the specified path (./data/). If it does not exist, create the file with the required configuration.

towfiqi commented 6 months ago

The error should appear only once when the app tries to create settings.json file. Once the settings.json file has been created, you should not see the error message.

AntoineKM commented 6 months ago

Yes, I've seen that, but for new users like me it can be confusing, especially since I really followed the documentation step by step, it might be better to check if it exists first?

towfiqi commented 2 weeks ago

It already checks if the settings file exists or not. See getAppSettings function cron.js file.