vendredi 3 décembre 2021

ember-cordova - Invalid or unexpected token on __dirname

I'm trying to build Android app using my Ember frontend and Cordova.

  1. I've configured project as described in ember-cordova docs (changed rootURL and locationType),
  2. I installed ember-cordova via ember install ember-cordova,
  3. Changed app name and widget id in cordova/config.xml,
  4. Added required platform - ember cdv:platform add android,
  5. And I'm trying to build first version of my app using ember cdv:build --platform=android --environment=production.

Unfortunatelly, build fails with error:

EmberCordovaError: Invalid or unexpected token


Stack Trace and Error Report: /tmp/error.dump.0bfefb855ac286c6b6600c600e92d126.log

It happens both on Ubuntu 21.10 and macOS Monterey. I'm using node v12.22.7 installed via node version manager (tried using node from apt packages on Ubuntu, but it didn't help), ember-cordova v1.0.9, and ember v3.12.1.

Full error log:

=================================================================================

ENV Summary:

  TIME: Fri Dec 03 2021 12:37:28 GMT+0100 (GMT+01:00)
  TITLE: ember
  ARGV:
  - /home/tomasz/.nvm/versions/node/v12.22.7/bin/node
  - /home/tomasz/.nvm/versions/node/v12.22.7/bin/ember
  - cdv:build
  - --platform=android
  - --environment=production
  EXEC_PATH: /home/tomasz/.nvm/versions/node/v12.22.7/bin/node
  TMPDIR: /tmp
  SHELL: /bin/bash
  PATH:
  - /home/tomasz/.rvm/gems/ruby-3.0.3/bin
  - /home/tomasz/.rvm/gems/ruby-3.0.3@global/bin
  - /home/tomasz/.rvm/rubies/ruby-3.0.3/bin
  - /home/tomasz/.rvm/bin
  - /home/tomasz/.local/bin
  - /home/tomasz/bin
  - /home/tomasz/.nvm/versions/node/v12.22.7/bin
  - /home/tomasz/.local/bin
  - /home/tomasz/bin
  - /usr/local/sbin
  - /usr/local/bin
  - /usr/sbin
  - /usr/bin
  - /sbin
  - /bin
  - /usr/games
  - /usr/local/games
  - /snap/bin
  - /home/tomasz/.rvm/bin
  PLATFORM: linux x64
  FREEMEM: 18971971584
  TOTALMEM: 33553645568
  UPTIME: 4862
  LOADAVG: 6.15,4.98,3.74
  CPUS:
  - Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz - 3505
  - Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz - 3565
  - Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz - 3800
  - Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz - 3800
  ENDIANNESS: LE
  VERSIONS:
  - ares: 1.17.2
  - brotli: 1.0.9
  - cldr: 37.0
  - http_parser: 2.9.4
  - icu: 67.1
  - llhttp: 2.1.4
  - modules: 72
  - napi: 8
  - nghttp2: 1.41.0
  - node: 12.22.7
  - openssl: 1.1.1l
  - tz: 2019c
  - unicode: 13.0
  - uv: 1.40.0
  - v8: 7.8.279.23-node.56
  - zlib: 1.2.11

ERROR Summary:

  - broccoliBuilderErrorStack: [undefined]
  - code: [undefined]
  - codeFrame: [undefined]
  - errorMessage: EmberCordovaError: Invalid or unexpected token
  - errorType: [undefined]
  - location:
    - column: [undefined]
    - file: [undefined]
    - line: [undefined]
  - message: EmberCordovaError: Invalid or unexpected token
  - name: EmberCordovaError
  - nodeAnnotation: [undefined]
  - nodeName: [undefined]
  - originalErrorMessage: [undefined]
  - stack: (function (exports, require, module, __filename, __dirname) { #!/usr/bin/env node
                                                              ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:88:7)
    at createScript (vm.js:261:10)
    at Object.runInThisContext (vm.js:309:10)
    at wrapSafe (internal/modules/cjs/loader.js:902:15)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Api.getPlatformInfo (/home/tomasz/Projects/app-ember/ember-cordova/cordova/platforms/android/cordova/Api.js:174:22)
    at /home/tomasz/Projects/app-ember/node_modules/cordova-lib/src/cordova/prepare.js:53:67
    at Array.map (<anonymous>:null:null)
    at /home/tomasz/Projects/app-ember/node_modules/cordova-lib/src/cordova/prepare.js:51:43
    at _fulfilled (/home/tomasz/Projects/app-ember/node_modules/cordova-lib/node_modules/q/q.js:787:54)
    at /home/tomasz/Projects/app-ember/node_modules/cordova-lib/node_modules/q/q.js:816:30
    at Promise.promise.promiseDispatch (/home/tomasz/Projects/app-ember/node_modules/cordova-lib/node_modules/q/q.js:749:13)
    at /home/tomasz/Projects/app-ember/node_modules/cordova-lib/node_modules/q/q.js:557:44
    at flush (/home/tomasz/Projects/app-ember/node_modules/cordova-lib/node_modules/q/q.js:108:17)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)


=================================================================================

What could be a reason of such a failure?




Aucun commentaire:

Enregistrer un commentaire