Ionic vscode extension doesn't work due to user name has space in nodejs path

I installed the ionic extension in vscode recently. I created an empty folder and opened it in the extension. However, when I clicked the ionic icon, I didn’t get these three Projects in vscode - New Angular Project, New React Project and New Vue Project. Instead, I got an error that is listed in below:

node:internal/modules/cjs/loader:936 throw err; ^ Error: Cannot find module ‘c:\Users\Sean’ at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { code: ‘MODULE_NOT_FOUND’, requireStack: }

I realised that I have a space in my user name (Sean Li) under the Users folder that caused the error. If I create another user without space in my Windows and install the extension in vscode, it will succeed; but, I don’t want to do this way as I have installed many application under my current user profile. I tried to fix the error by following this thread in Stack Overflow (Spaces in PATH npm) and executed this command:
npm config set cache “C:\Users\Sean~1\AppData\Roaming\npm-cache” --global

Unfortunately it didn’t work. I spent several days to fix this error without success. Can anybody please point out a direction to fix the error? Thanks a lot in advance.


This could probably be an issue with the extension so I suggest you report it in the official repo: Issues · ionic-team/vscode-extension · GitHub

The issue is already reported in GitHub. Thanks for help.

1 Like