ember-cli-migrator icon indicating copy to clipboard operation
ember-cli-migrator copied to clipboard

Error running migrator

Open lifeinafolder opened this issue 10 years ago • 7 comments

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.

lifeinafolder avatar May 14 '15 22:05 lifeinafolder

How does your app.js look like?

igorT avatar May 14 '15 22:05 igorT

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');
  }
});

lifeinafolder avatar May 14 '15 23:05 lifeinafolder

I am not sure we support custom namespaces, maybe @fivetanley or @tonysherbondy know

igorT avatar May 15 '15 03:05 igorT

I experience the same issue. Is there any solution?

Mitchal avatar Mar 12 '17 13:03 Mitchal

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.

hefox avatar Nov 28 '17 00:11 hefox

Thanks a bunch for the fix. I merged the PR

igorT avatar Nov 28 '17 00:11 igorT

https://github.com/fivetanley/ember-cli-migrator/pull/84 so far this appears to fix the errors I saw

hefox avatar Dec 06 '17 20:12 hefox