Ionic-cli: Updating cli from 6.9.3 → 6.10.1 SyntaxError: Unexpected token 'export'

Created on 26 Jul 2020  Â·  4Comments  Â·  Source: ionic-team/ionic-cli

Description:
After update getting error

Steps to Reproduce:

  1. install latest version ionic cli
npm i -g @ionic/cli@latest
  1. check version or serve your project
ionic -v

Output:

bossjon@boss:~$ ionic -v
6.10.1
/usr/local/lib/node_modules/@ionic/cli/node_modules/uuid/dist/esm-browser/index.js:1

export { default as v1 } from './v1.js';
^^^^^^

SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/usr/local/lib/node_modules/@ionic/cli/lib/utils/uuid.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)

My ionic info:

bossjon@boss:~$ ionic info
/usr/local/lib/node_modules/@ionic/cli/node_modules/uuid/dist/esm-browser/index.js:1

export { default as v1 } from './v1.js';
^^^^^^

SyntaxError: Unexpected token 'export'
at wrapSafe (internal/modules/cjs/loader.js:1053:16)
at Module._compile (internal/modules/cjs/loader.js:1101:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/usr/local/lib/node_modules/@ionic/cli/lib/utils/uuid.js:3:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
[WARN] You are not in an Ionic project directory. Project context may be missing.

Ionic:

   Ionic CLI : 6.10.1

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.18.3
   npm    : 6.14.6
   OS     : Linux 5.4

Ps: Other versions works fine.

triage

Most helpful comment

Please try 6.10.2 with this fix.

All 4 comments

Same issue here. I uninstalled the old CLI by running these commands

npm uninstall -g ionic
npm install -g @ionic/cli

Now I get this error when I run anything ionic-related it seems. I also just tried to create a template project to compare to my current project to see what the difference might be, but I'm having no luck - the template creation goes in circles. I ran

ionic start myApp tabs

This shows the error but then steps me through the project creation with no problems (seemingly). Then I ran

ionic start

which just asked me what template I want to use and has me going in circles.

Seems related to this issue? https://github.com/uuidjs/uuid/issues/488

It appears to be importing an ES6/browser version, despite using const uuid = require('uuid').

Anyway, our requirements for generating a UUID aren't enough to warrant continuing to use that module. I replaced it with an inline version in https://github.com/ionic-team/ionic-cli/pull/4501.

Please try 6.10.2 with this fix.

Was this page helpful?
0 / 5 - 0 ratings