Skip to content

Unable to create new Ionic app with @ionic/cli #4434

Closed

Description

@Sbearlin

Description:
Hi.
I've been wanting to create a new ionic app for a while and decided to create a new one since React support came out. I followed the guide from this link: Ionic start

It finalizes with introducing the following steps to run:
npm install -g @ionic/cli cordova-res
ionic start --start-id ID-FOR-CREATION

However running the ionic command (or just writing ionic) fails to run. So essentially the entire ionic cli is not working. I've tested following versions of @ionic/cli: 6.9.0, 6.8.0, 6.7.0 and 6.5.0.

I have noticed weird symbols in the error message, it might have something to do with it?

My current environment:
Windows 10 Pro (en-GB)
Node v14.2.0
NPM 6.14.5

Steps to Reproduce:
npm install -g @ionic/cli cordova-res
ionic start

Output:
C:\Users\ahb\AppData\Roaming\nvm\v14.2.0\node_modules@ionic\cli\node_modules@ionic\utils-fs\dist\index.js:168
exports.pathExists = pathExists;
^

TypeError: Cannot set property pathExists of # which has only a getter
at Object. (C:\Users\ahb\AppData\Roaming\nvm\v14.2.0\node_modules\�[4m@ionic�[24m\cli\node_modules\�[4m@ionic�[24m\utils-fs\dist\index.js:168:20)
�[90m at Module._compile (internal/modules/cjs/loader.js:1176:30)�[39m
�[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)�[39m
�[90m at Module.load (internal/modules/cjs/loader.js:1040:32)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:929:14)�[39m
�[90m at Module.require (internal/modules/cjs/loader.js:1080:19)�[39m
�[90m at require (internal/modules/cjs/helpers.js:72:18)�[39m
at Object. (C:\Users\ahb\AppData\Roaming\nvm\v14.2.0\node_modules\�[4m@ionic�[24m\cli\node_modules\�[4m@ionic�[24m\cli-framework\utils\node.js:3:20)
�[90m at Module._compile (internal/modules/cjs/loader.js:1176:30)�[39m
�[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)�[39m

My ionic info:
Unable to run any ionic commands. All of them produce the error above

Activity

  1. s3ppo commented on May 12, 2020

    @s3ppo

    i have the same issue

    edit:
    i tried to rollback to an older version with npm cache reset but its still not working any more
    i am on MacOS

  2. added a commit that references this issue on May 12, 2020
  3. ChokeBilly commented on May 12, 2020

    @ChokeBilly

    Me too
    (using MacOS)

  4. roman-rr commented on May 12, 2020

    @roman-rr

    Error appears always with any command start with $ ionic

  5. MonoHearted commented on May 12, 2020

    @MonoHearted

    Same issue, on macOS Catalina. I created a thread on the forum a bit ago as well:

    https://forum.ionicframework.com/t/ionic-cli-typeerror/189272

  6. liamplm commented on May 12, 2020

    @liamplm

    Same issue on Linux

  7. jeanpfs commented on May 12, 2020

    @jeanpfs

    Same issue on Windows 10

  8. imhoffd commented on May 12, 2020

    @imhoffd
    Contributor

    Looks like an incompatibility between tslib 1.12.0 and our FS utility library. I've pinned tslib, which should fix the issue for now.

    Please update the Ionic CLI to fix the issue:

    npm i -g @ionic/cli@6.9.1
    
  9. TMarafon commented on May 12, 2020

    @TMarafon

    Even updating to 6.9.1 the problem still persists.

  10. imhoffd commented on May 12, 2020

    @imhoffd
    Contributor

    Maybe try

    npm uninstall -g @ionic/cli 
    npm cache clear --force
    npm install -g @ionic/cli@6.9.1
    
  11. netowp commented on May 12, 2020

    @netowp

    If you are still having problems to execute ionic serve or similar commands, do a npm install tslib@1.11.0 that should solve that issue, right after doing @dwieeb solution.

  12. TMarafon commented on May 12, 2020

    @TMarafon

    Ok, @netowp 's suggestion solved my issue when running ionic serve, however ionic cordova build ios is still failing.

        ** BUILD FAILED **
    
        xcodebuild: Command failed with exit code 65
        [ERROR] An error occurred while running subprocess cordova.
        
        cordova build ios exited with exit code 65.
    
  13. imhoffd commented on May 12, 2020

    @imhoffd
    Contributor

    @TMarafon That's a separate issue.

  14. asharm52 commented on May 12, 2020

    @asharm52

    I've done the step mentioned by @dwieeb and followed it up with the one by @netowp , but am still getting:

    TypeError: Cannot set property pathExists of # which has only a getter

  15. MechanicalMann commented on May 12, 2020

    @MechanicalMann

    @dwieeb I discovered this issue because we are encountering the same error in a project that is still using the deprecated Ionic CLI (v5.4.16). You mentioned that the issue appears to be an incompatibility between tslib and @ionic/utils-fs. That would explain why we are also experiencing the problem.

    Would it be possible to pin tslib and publish a fix to the @ionic/utils-fs library instead of the downstream packages? That would address the problem for us and probably more broadly.

  16. AleFons commented on May 13, 2020

    @AleFons

    @malorisdead I'm also using a deprecated CLI and pinning tslib didn't work for me.

  17. dmoreno85 commented on May 13, 2020

    @dmoreno85

    npm uninstall ionic
    npm cache clear --force
    npm install -g @ionic/cli@6.9.1

    This works for me!!

  18. stewx commented on May 13, 2020

    @stewx

    We are on ionic@4.12.0 and our pipeline is broken because of this. Setting the tslib version to 1.11.2 locally and globally has not resolved it.

  19. srinivasangurukannan commented on May 13, 2020

    @srinivasangurukannan

    I tried uninstall 6.9.1 and downgrade various versions.

    At present 6.0.0. its failing..

    Install of tslib also didnt work ..

    image

    Kindly help me to address the issues

  20. imhoffd commented on May 13, 2020

    @imhoffd
    Contributor

    @malorisdead

    Would it be possible to pin tslib and publish a fix to the @ionic/utils-fs library instead of the downstream packages?

    Unfortunately we use exact versions of @ionic/utils-* dependencies (see 5.4.16's package.json), so we'd have to do a full CLI release.

    I would bet this problem will fix itself as this comment suggests a tslib fix is coming soon: microsoft/tslib#102 (comment)

    You can also follow the issue I created here: microsoft/tslib#103


    If you're using an old CLI version, is there a reason you're not using the latest? The Ionic CLI supports all versions of the Ionic Framework and breaking changes are minimal (mostly related to changing the minimum NodeJS version).

  21. MechanicalMann commented on May 13, 2020

    @MechanicalMann

    In our case, it was a CI pipeline that was using the deprecated version. Since the deprecation happened recently but our builds were unaffected, our devops team considered upgrading to be a low priority. Due to this issue we have now upgraded to 6.9.1 and the issue is resolved for us.

    Thank you for clarifying the package dependencies and linking to the associated tslib issues. It seems that this is a much broader problem with the release of tslib 1.12.0. I hope Microsoft releases a patch soon.

  22. stewx commented on May 13, 2020

    @stewx

    I fixed our problem by downgrading to ionic@4.0.1

  23. sarasailors commented on May 13, 2020

    @sarasailors

    We are using ionic 4.7.1 and getting the pathExists error for anyone trying to install ionic the old way. @dwieeb when you say "The Ionic CLI supports all versions of the Ionic Framework and breaking changes are minimal (mostly related to changing the minimum NodeJS version)." When I've tried to install the new cli with version 4.7.1 specifically, it does not exist. We are not ready to upgrade yet for our released version and now we cannot even have it in development without getting the pathExists error. Any suggestions? Have also tried updating tslib and downgrading per the suggestion above to 4.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions