Cannot install old version of ionic

I need to install a version 1.6.4 because I have a project that i have to maintain;
When I try to install npm install -g ionic@1.6.4
I get this error
sudo npm install -g ionic@1.6.4
npm ERR! fetch failed https://registry.npmjs.org/miller-rabin/-/miller-rabin-2.1.0.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 504
npm ERR! fetch failed https://registry.npmjs.org/miller-rabin/-/miller-rabin-2.1.0.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 504
npm ERR! fetch failed https://registry.npmjs.org/miller-rabin/-/miller-rabin-2.1.0.tgz
npm ERR! Linux 4.4.0-34-generic
npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” "ionic@1.6.4"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2

npm ERR! fetch failed with status code 504
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ederson/npm-debug.log