Ardakilic / alerthub

AlertHub is a simple tool written with NodeJS to get alerted from new GitHub and GitLab repository events.
MIT License
200 stars 12 forks source link

Does not run anymore after pushbullet update #56

Closed reconman closed 2 years ago

reconman commented 2 years ago

Since pushbullet was updated, the following error happens when you start the application:

const PushBullet = require('pushbullet');
                   ^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Github\alerthub\node_modules\pushbullet\lib\pushbullet.js from C:\Github\alerthub\src\utils\pushBullet.js not supported.
Instead change the require of pushbullet.js in C:\Github\alerthub\src\utils\pushBullet.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\Github\alerthub\src\utils\pushBullet.js:1:20)
    at Object.<anonymous> (C:\Github\alerthub\src\index.js:9:25) {
  code: ←[32m'ERR_REQUIRE_ESM'←[39m
}

The pushbullet library is now an ES module and cannot be imported as a CommonJS library anymore.

Importing ES modules into CommonJS modules is not that easy, so I would recommend switching the whole project to ES modules, which can both import CommonJS and ES modules.

Ardakilic commented 2 years ago

Thanks to you, #57 should fix this 🙏