Package breaks with atom 1.2.0


#1

I just upgraded my atom 1.0-19 to 1.2.0. All of a sudden, my in development linter-ansible-linting failed to load with the following stack trace:

SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:413:25)
at Object.defineProperty.value [as .js] (/usr/share/atom/resources/app.asar/src/compile-cache.js:190:21)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Package.module.exports.Package.requireMainModule (/usr/share/atom/resources/app.asar/src/package.js:661:34)
at /usr/share/atom/resources/app.asar/src/package.js:115:28
at Package.module.exports.Package.measure     (/usr/share/atom/resources/app.asar/src/package.js:92:15)

I noticed that my previously released version of my package was loading fine on another computer also running atom 1.2.0. I decided to revert all of my in development code changes to the previous release code and the error still appears on loading.

So in summary:

Upgrading atom from 1.0-19 to 1.2.0 suddenly breaks package.
Reverting code to previous version that is working on another computer with atom 1.2.0 does not work on current computer running atom 1.2.0 (OS differences are: working - CentOS 7.1, broken - Ubuntu 15.04).

I have no idea how to begin debugging this as this seems extremely insidious and hidden.


Downgrading to atom 1.1.0 actually yielded better debug information than 1.2.0 for some reason:

/home/matt/git_repos/linter-ansible-linting/lib/main.js:4
export default {
^^^^^^
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:411:25)
at Object.defineProperty.value [as .js] (/usr/share/atom/resources/app.asar/src/compile-cache.js:169:21)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Package.module.exports.Package.requireMainModule (/usr/share/atom/resources/app.asar/src/package.js:725:34)
at /usr/share/atom/resources/app.asar/src/package.js:176:28
at Package.module.exports.Package.measure (/usr/share/atom/resources/app.asar/src/package.js:153:15)

I have the export default in another package I made and several I have downloaded. What is unique about this package that is causing an issue?


#2

Have you deleted the node_modules directory in the root of your package’s repository and re-run apm install from the same location? It could be that since I believe Electron changed between v1.1.0 and v1.2.0 that something is compiled against a different version of V8?


#3

I will give that a try as it certainly seems valid given the evidence, although I have steelbrain’s packagedeps node_module in my ‘linter-puppet-parsing’ and that package loads ok.

Side note: I tried ‘export default’ --> ‘module.exports default’ and that did not load either with a syntax error.


#4

Yeah removing the node_modules did not fix it. Also steelbrain’s packagedeps is not an atom package as far as I can tell (I had to grab it from linter-ruby I believe).

If I change ‘export default’ --> ‘module.exports default’ in atom 1.1.0 with its superior debug messages to atom 1.2.0 (for some reason) it throws 'unexpected token default.'
This seems borderline impossible to debug so I may just have to specify <1.1.0 in the package.json and hope this goes away with 1.3.0.

I think going back to 1.0.19 is going to be a good idea for me in general because I notice that doing a view–>reload causes the atom menu to disappear in 1.1.0.


Ok turns out downgrading back to 1.0.19 still has the error during loading. So it looks like installing ANY version of atom triggers this error.


#5

Ok I figured it out: apparently in javascript you cannot have the first line be a comment and this was one of several changes I made before a reload.

I cannot fathom how this is a scripting language that people would use when ruby, python, and even perl exist.

Well anyway… problem solved.


#6

They don’t exist in browsers.


#7

Rather off topic, but python --> django, ruby --> rails, and perl I thought needs no web framework.

I am not a web app developer so I would not know for sure but that is what I have been lead to believe.


#8

That’s true, but those run on the web server and generate HTML pages that it sends to a browser. The HTML is then loaded into the DOM in the browser which can be manipulated with JavaScript. The server side frameworks don’t have anything to do with the DOM manipulation.

Atom is just a local application that runs inside a chrome process, there is no (web) server that serves any HTML, so JavaScript is really the only language available.

I’m also curious what led you to believe you can’t have a comment on the first line of a js file, because that should definitely be possible.


#9

comment on first line of script --> error listed above
comment on second line of script --> no error

That would be why.
edit: not trying to sound like a smartass here if you get that impression


#10

The issue is a bit different.

  1. Javascript totally suport first line comment.
  2. Some tooling migth use first line as directive.

It looks like you have run into a case of (2) but it does not imply (1) is false.

not trying to sound like a smartass

Well the JavaScript as a terrible language comment was a bit inflammatory. But it’s a common reaction to things that are new/different. For example I find Lisp and derivative to be totally unreadable.