Ionic CLI TypeError

Hi there,

I recently installed @ionic/cli via NPM, with the LTS branch of Node on macOS Catalina.

However, running any ionic command results in a TypeError from index.js:

/usr/local/lib/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> (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/utils-fs/dist/index.js:168:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@ionic/cli/node_modules/@ionic/cli-framework/utils/node.js:3:20)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)

I’ve tried uninstalling/reinstalling Node, upgrading to latest; uninstalling @ionic/cli, even attempted installing the old deprecated “ionic” package, all with the same issue. I can’t even run ionic --version without this issue appearing.

Any help would be greatly appreciated.

1 Like

Posted the same issue just 5 minutes back. Getting this issue after updating.

1 Like

I saw your post almost immediately after posting mine; couldn’t reply for some reason.

It’s at least comforting to know that I’m not alone with this issue. Please let me know if you find a solution.

4 Likes

I’m having the same issue, I tried to reinstall everything but still having this issue

1 Like

Having exactly the same issue

As all the users above, I’m having the same exact issue using the deprecated package, not tried the new one

A Github issue opened for this about an hour ago as well. Leaving it here for anyone else who may want to track/follow the issue.

2 Likes

Thank you so much for this. Trying to work out a bug for a client all day and its become so frustrating when a blank template doesn’t event work!

npm i -g @ionic/cli@6.9.1

3 Likes

Looks like it just got fixed in a new version (6.9.1).

Hey, sorry to interrupt but did the fix work for you? Running ionic serve after a clean project using ionic1 still shows the same error for me.

UPDATE:
I fixed my update not reflected issue by running npm i -g @ionic/v1-toolkit@3.2.2 on the project root :+1:

I have a similar problem when running “ionic serve” and this is the message:
“TypeError: Cannot set property pathExists of # which has only a getter%”

/usr/local/lib
├── @ionic/cli@6.9.1
├── npm@6.14.4
└── sass@1.23.1

I think that you have to remove global option (-g) to update local version. For me it worked, thanks!!

I solved it by running these commands:

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

Hope it will help you.

Well, I seem to be stuck still. Brand new MacBook so I just installed ionic this morning. Uninstalling and cache cleaning doesn’t seem to work at all. After doing those I run ionic --version and I get the same pathExists error so it seems one or both of those commands isn’t working.

UPDATE: I had to totally remove node and reinstall it, then install ionic 6.9.1 and the pathExists error is gone now.