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.
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%”
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.