ember-cli-migrator
ember-cli-migrator copied to clipboard
Error running migrator
I tried to migrate an ember app but ran into the following issue:
Preprocessing files
Failed to parse app.js
Note that you probably don't want to run the migrator against your npm or bower dependencies. Make sure that the directory you've specified in the '--source' flag only contains your application code.
Error: Line 12: Unexpected token ILLEGAL
/usr/local/lib/node_modules/ember-cli-migrator/lib/ember-migrator.js:189
var astBody = ast.program.body;
^
TypeError: Cannot read property 'program' of undefined
at EmberMigrator.splitFile (/usr/local/lib/node_modules/ember-cli-migrator/lib/ember-migrator.js:189:20)
at Array.forEach (native)
at EmberMigrator_run [as run] (/usr/local/lib/node_modules/ember-cli-migrator/lib/ember-migrator.js:82:11)
at Object.<anonymous> (/usr/local/lib/node_modules/ember-cli-migrator/bin/ember-cli-migrator:30:10)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
I am using Ember-Rails gem. Any help would be appreciated.
How does your app.js look like?
Test = Ember.Namespace.create();
Test.App = Ember.Application.create({
data: [], // some static data as placeholder for a BE response
ready: function () {
console.log('Ember Application Ready');
}
});
I am not sure we support custom namespaces, maybe @fivetanley or @tonysherbondy know
I experience the same issue. Is there any solution?
This error happens when recast is unable to parse a file, e.g. the Error: Line 12: Unexpected token ILLEGAL is it's parse error for app.js
However, it's not returning after catching the error which means it's goes to the next step with an invalid object, added a PR https://github.com/fivetanley/ember-cli-migrator/pull/83 to fix the error handling.
Thanks a bunch for the fix. I merged the PR
https://github.com/fivetanley/ember-cli-migrator/pull/84 so far this appears to fix the errors I saw