Search code examples
angularangular-cli

How to uninstall/upgrade Angular CLI?


When I try to create a new project with Angular CLI, with:

ng n app

I get this error:

fs.js:640 return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode); ^ TypeError: path must be a string or Buffer at TypeError (native)

How can I upgrade or uninstall Angular CLI?


Solution

  • Using following commands to uninstall :

    npm uninstall -g @angular/cli
    npm cache clean --force
    

    To verify: ng --version /* You will get the error message, then u have uninstalled */

    Using following commands to re-install :

    npm install -g @angular/cli
    

    Notes : - Using --force for clean all the caches - On Windows run this using administrator - On Mac use sudo ($ sudo <command>)

    • If you are using npm>5 you may need to use cache verify instead. ($ npm cache verify)