macにcordovaインストールエラーメモ

新PCにcordovaのバージョン6.5.0入れようとしたら、他のPCでは出なかったのに以下のようなエラーが。。。

$ npm install -g cordova@6.5.0
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm ERR! path /usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/ansistyles' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxxxx/.npm/_logs/2018-02-05T15_16_32_007Z-debug.log

ぐぐていくつか試したけどうまくいかず。。
で、1度、バージョン指定なしでインストール後にアンインストールしたらうまくいった。

$ npm install -g cordova
$ npm uninstall -g cordova
$ npm install -g cordova@6.5.0

以上です