menu

Questions & Answers

How can I fix the error preifx 'g' is not recognised as an internal or external command?

I have confirmed node.js and npm are installed as per the screenshot attached. However I also get a message before npm version number as shown and i think its the whole reason why i cant execute some npm commands. I have tried to uninstall nodejs and remove all associated files and re-install it again with no help nor has running command prompt as an admin.

I have also tried solutions that refer to 'npm is not recognized as an internal or external command' and tried to apply with no help. I havent seen a solution that is referring to 'prefix -g' is not recognized as an internal or external command'

All help to understand what the message is all about and how to make sure that it doesnt appear will be appriciated.

enter image description here

Answers(1) :

My perseverance paid off.I found the solution here

https://github.com/npm/npm/issues/8312. I needed to completely remove "ComSpec" variable from my Environment Variable. phew.

enter image description here