alerthub icon indicating copy to clipboard operation
alerthub copied to clipboard

Does not run anymore after pushbullet update

Open reconman opened this issue 2 years ago • 0 comments

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.

reconman avatar Aug 26 '22 19:08 reconman