ionic-cli: Unable to create new Ionic app with @ionic/cli

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 #<Object> which has only a getter at Object.<anonymous> (C:\Users\ahb\AppData\Roaming\nvm\v14.2.0\node_modules\@ionic\cli\node_modules\@ionic\utils-fs\dist\index.js:168:20)  at Module._compile (internal/modules/cjs/loader.js:1176:30)  at Object.Module._extensions…js (internal/modules/cjs/loader.js:1196:10)  at Module.load (internal/modules/cjs/loader.js:1040:32)  at Function.Module._load (internal/modules/cjs/loader.js:929:14)  at Module.require (internal/modules/cjs/loader.js:1080:19)  at require (internal/modules/cjs/helpers.js:72:18) at Object.<anonymous> (C:\Users\ahb\AppData\Roaming\nvm\v14.2.0\node_modules\@ionic\cli\node_modules\@ionic\cli-framework\utils\node.js:3:20)  at Module._compile (internal/modules/cjs/loader.js:1176:30)  at Object.Module._extensions…js (internal/modules/cjs/loader.js:1196:10)

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

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 11
  • Comments: 22 (4 by maintainers)

Commits related to this issue

Most upvoted comments

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

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.

Error appears always with any command start with $ ionic

Maybe try

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

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.

@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.

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 #<Object> which has only a getter