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?
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>
)
npm>5
you may need to use cache verify instead. ($ npm cache verify
)None of the above solutions alone worked for me. On Windows 7 this worked:
Install Rapid Environment Editor and remove any entries for node, npm, angular-cli or @angular/cli
Uninstall node.js and reinstall. Run Rapid Environment Editor again and make sure node.js and npm are in your System or User path. Uninstall any existing ng versions with:
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clean
Delete the C:\Users\YOU\AppData\Roaming\npm\node_modules\@angular
folder.
Reboot, then, finally, run:
npm install -g @angular/cli
Then hold your breath and run ng -v. If you're lucky, you'll get some love. Hold your breath henceforward every time you run the ng command, because 'command not found' has magically reappeared for me several times after ng was running fine and I thought the problem was solved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With