thomasjo / atom-latex

Compile LaTeX or knitr documents from within Atom
https://atom.io/packages/latex
MIT License
223 stars 42 forks source link

Failed to activate #488

Closed Evpok closed 6 years ago

Evpok commented 6 years ago

Exception thrown at package activation

Atom: 1.32.0-beta0 x64 Electron: 2.0.9 OS: KDE neon Thrown From: latex package 0.50.0

Stack Trace

Failed to activate the latex package

At Class constructor Disposable cannot be invoked without 'new'

TypeError: Class constructor Disposable cannot be invoked without 'new'
    at /packages/latex/lib/latex.js:18:27)
    at Object.bootstrap (/packages/latex/lib/main.js:85:20)
    at Object.activate (/packages/latex/lib/main.js:7:10)
    at Package.activateNow (/usr/share/atom-beta/resources/app/static/<embedded>:11:2898797)
    at string.e.trim.length.activationHookSubscriptions.add.packageManager.onDidTriggerActivationHook (/usr/share/atom-beta/resources/app/static/<embedded>:14:2445)
    at Function.simpleDispatch (/usr/share/atom-beta/resources/app/static/<embedded>:11:1183960)
    at Emitter.emit (/usr/share/atom-beta/resources/app/static/<embedded>:11:1185149)
    at PackageManager.triggerDeferredActivationHooks (/usr/share/atom-beta/resources/app/static/<embedded>:11:378885)
    at Promise.all.then (/usr/share/atom-beta/resources/app/static/<embedded>:11:377683)
    at <anonymous>
Aerijo commented 6 years ago

I think it's a babel thing; see this issue. Not sure what caused it yet, or if it can be fixed on this end.

Aerijo commented 6 years ago

Wow, it's obscure.

So this package transpiles eveything through babel, and targets es2015 or something. That's fine. I spent a long time looking for changes in Babel related files in Atom core, but no dice. Then I search the error some more, and see a passing comment about this being incompatible with es6 modules.

OK. So the issue is we're extending Disposable, which is defined in event-kit. Turns out that module was decaffeinated a couple of weeks ago, into the new es6 syntax. Before this, it was being compiled into the same JS version as Babel is, so everything was happy. Now it's not.

And to confirm, it worked when I built Atom using event-kit@2.5.0 (the previous version).

thomasjo commented 6 years ago

@Aerijo Thanks for tracking down the problem! Now to figure out if there's some way of fixing this without making changes to event-kit...

delta-one commented 6 years ago

I also get the same error with Atom 1.31.2, but my stack trace is different, so it's likely not the sam eissue.

Atom: 1.31.2 x64 Electron: 2.0.7 OS: Debian GNU/Linux Thrown From: latex package 0.50.0

Stack Trace

Failed to activate the latex package

At Cannot find module '../type/js/undefined'

Error: Cannot find module '../type/js/undefined'
    at Module._resolveFilename (module.js:543:15)
    at Module._resolveFilename (/usr/share/atom/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.get_Module._resolveFilename (/usr/share/atom/resources/app/src/module-cache.js:354:58)
    at Module.require (/app.asar/static/index.js:40:43)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml/schema/default_full.js:21:5)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml/schema/default_full.js:27:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml/loader.js:9:27)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml/loader.js:1600:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
    at Module.require (/app.asar/static/index.js:47:45)
    at require (/usr/share/atom/resources/app/src/native-compile-cache.js:66:33)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml.js:4:14)
    at /packages/latex/node_modules/js-yaml/lib/js-yaml.js:41:3)
    at Module.get_Module._compile (/usr/share/atom/resources/app/src/native-compile-cache.js:106:36)
    at Object.value [as .js] (/usr/share/atom/resources/app/src/compile-cache.js:240:29)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:504:12)
    at Function.Module._load (module.js:496:3)
maxbrunsfeld commented 6 years ago

Wow, sorry this was broken for so long. The bug was a very unexpected consequence of using JavaScript classes, instead of Coffee-script classes (which compile to regular JavaScript functions). This will be fixed in Atom 1.32. The fix is here: https://github.com/atom/event-kit/pull/44.

thomasjo commented 6 years ago

@maxbrunsfeld Thanks for the fix and the update!

thomasjo commented 6 years ago

Closing this as fixed; the issue will not be present when Atom 1.32 is released.