check user permission before downloading tarball of package

I’ve tried to install a package globally but i got the Error: EACCES: permission denied, access '/usr/local/lib/node_modules' after downloading the tarball of package. So why not check the user permission level before downloading?