Cannot find module after installing ionic

Hi all,

Just a quick overview. I have been having a problem all day I have been trying to solve myself but I don’t understand what is happening. But to get past this one problem here is what is happening.

If I run npm install -g @ionic/cli it install ionic like it is supposed to but once I try to access ionic in any way such as ionic --help I get

internal/modules/cjs/loader.js:983
throw err;
^

Error: Cannot find module ‘C:\Windows\System32\node_modules@ionic\cli\bin\ionic’
e[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)e[39m
e[90m at Function.Module._load (internal/modules/cjs/loader.js:862:27)e[39m
e[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)e[39m
e[90m at internal/main/run_main_module.js:17:47e[39m {
code: e[32m’MODULE_NOT_FOUND’e[39m,
requireStack:
}

Once thing I noticed is that it isn’t putting a node_modules folder in C:\Windows\System32\node_modules it puts it in C:\Users%USER%\AppData\Roaming\npm\node_modules

Why is ionic not installing to the right location (if it isn’t) and if it is supposed to put this in both locations how come it doesn’t.

Thanks for the help n advanced I have a very large Ionic app I have been working on and suddenyl I am at a stand still.

Thanks
Darrell

Did you tried running the ionic command with administrator cmd? if not then please try that way once. and if yes then try reinstalling node and ionic and then reinstalling.

Thanks for the answer, unfortunately I’ve tried both of those. In fact I’ve uninstalled and reinstalled nodejs a number of times. With different versions even. Completely removed ionic and angular a few times also. I think
my nose paths are messed up but besides the environmental variables I have no idea where those are getting set. Thanks again. I’m so close to just wiping my computer and starting from scratch.

If you do this, I would suggest installing nvm-windows to manage all your node installations. Oh, and never run anything ionic-development-related with administrator privileges.