I tried to install ionic but it returns : npm ERR! code E418

So, post may 29th '18, this is the common error being faced worldwide by devs working behind corporate proxies. The following tweak fixed the issue for me:

  1. Go to your .npmrc file.

    you'll have the following similar content in the file depending upon the configs you are setting up-

    strict-ssl=false
    registry=http://registry.npmjs.org/
    python=C:/Python27/python.exe
    msvs_version=2015
    http-proxy=<WHATEVER-PROXY-YOU-USUALLY-ADD>:8000
    

Note: Ignore the extra configs like python variable path.

  1. Update the registry link to 'https://registry.npmjs.org/'. So your file would look like this now-

     strict-ssl=false
     registry=https://registry.npmjs.org/
     python=C:/Python27/python.exe
     msvs_version=2015
     http-proxy=<WHATEVER-PROXY-YOU-USUALLY-ADD>:8000
    
  2. And Viola! you are all set to fire your npm install commands :)


Work for me!

If you set proxy should be unset.

npm config delete proxy
npm config delete https-proxy

Solution resolve npm ^___^

npm cache clean --force
npm cache verify 

I had the very same issue and managed to fix it. In my case, I initially had the value of "http://registry.npmjs.org/" and changed it to "https". Below are the set of commands I ran:

npm config set registry https://registry.npmjs.org/
npm cache clean --force
npm cache verify

npm install