Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Bree is not a constructor #240

Closed
Banjer71 opened this issue Jan 17, 2024 · 3 comments
Closed

TypeError: Bree is not a constructor #240

Banjer71 opened this issue Jan 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Banjer71
Copy link

Describe the bug

Node.js version: Node v18.7.0

OS version: Windows 10

Description: I am getting this error TypeError: Bree is not a constructor.
The script is below , I searched online but I did not get any useful solutions

Code to reproduce

`
const { Bree } = require("bree");
const bree = new Bree({
jobs: [
{
name: 'sendVerseEmails',
interval: '1 minute',
worker: async () => {
// get songs with verses
const songs = await SplittedLyrics.find({ verses: { $exists: true } });

    songs.forEach(async (song) => {
      const verse = getNextVerse(song);

      if (verse) {
        // send verse
        sendVerseByEmail(song.userEmail, verse, song.title);

        // update lastSent
        await SplittedLyrics.findByIdAndUpdate(song._id, {
          lastSent: verse,
        });
      } else {
        // no more verses, delete song
        await SplittedLyrics.findByIdAndDelete(song._id);
      }
    });
  },
},

],
});
`

Checklist

  • [x ] I have searched through GitHub issues for similar issues.
  • [x ] I have completely read through the README and documentation.
  • [x ] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
@Banjer71 Banjer71 added the bug Something isn't working label Jan 17, 2024
@titanism
Copy link
Contributor

You need to use const Bree = require('bree') as noted in our README. Please read the README before filing GitHub issues and spamming users.

@Banjer71
Copy link
Author

Banjer71 commented Jan 17, 2024

@titanism

const Bree = require('bree')
I did it already and I was getting another error
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^

[Error: ENOENT: no such file or directory, stat 'C:\Users\Davide\Desktop\Lyrics Bites\mern\Lyrics-bites-backend-v2\jobs'] {
errno: -4058,
code: 'ENOENT',
syscall: 'stat',
path: 'C:\Users\Davide\Desktop\Lyrics Bites\mern\Lyrics-bites-backend-v2\jobs'
}

@titanism
Copy link
Contributor

Again, you need to read the README. It's looking for a folder called jobs which you have to create. See the README (CMD+F/CTRL+F for "jobs").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants