Npm fails to install a global tool on Windows

Npm may fail to install global tools; consider the symptom, cause, and solutions discussed as follows:

Symptom: When you attempt to install a global tool, you may get an error message containing the Refusing to delete message similar to the one shown here:

PS C:\WINDOWS\system32> npm i -g nownpm ERR! path C:\Users\duluc\AppData\Roaming\npm\now.cmdnpm ERR! code EEXISTnpm ERR! Refusing to delete C:\Users\duluc\AppData\Roaming\npm\now.cmd: node_modules\now\download\dist\now symlink target is not controlled by npm C:\Users\duluc\AppData\Roaming\npm\node_modules\nownpm ERR! File exists: C:\Users\duluc\AppData\Roaming\npm\now.cmdnpm ERR! Move it away, and try again.npm ERR! A complete log of this run ...

Get Angular 6 for Enterprise-Ready Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.