npm install Error: rollbackFailedOptional

    # first this
    > npm config rm proxy
    > npm config rm https-proxy

    # then this
    > npm config set registry https://registry.npmjs.org/

solved my problem.

Again: Be sure to check whether you have internet connected properly.


Try this

npm config rm proxy
npm config rm https-proxy

In my case I had to edit the .npmrc directly and add the proxy settings manually.

proxy=http://yourorganizationproxy.com:8080
https-proxy=http://yourorganizationproxy.com:8080

Hope this helps someone.


The cause for this might be your current NPM registry. Try to check for a .npmrc file. These can be at various locations:

  • per-project config file (/path/to/my/project/.npmrc)
  • per-user config file (~/.npmrc)
  • global config file ($PREFIX/etc/npmrc)
  • npm builtin config file (/path/to/npm/npmrc)

Within these there can be something like

registry=https://mycustomregistry.example.org

which will take priority over the default one (http://registry.npmjs.org/). You can delete this line in the file or use the default registry like that:

npm <command> --registry http://registry.npmjs.org/