Friday 18 January 2019

SPFx Environment Setup Error: rollbackFailedOptional: verb npm-session.

In this blog, I will be sharing how I have troubleshooted and found the solution to one of the errors I faced while setting up the development environment for SharePoint Framework while following the official documentation provided by Microsoft.

Faced issues while running the command shown below.


The execution got struck and freezes at this "rollbackFailedOptional" and after about ~5 minutes it gets completed with the below error messages:


After analyzing the error and log files, it appears that the error is related to network connectivity or some proxy problem. But I am not using any proxy. I'm on a corporate network. When I checked for any type of proxy, there was nothing.

I also checked the internet settings in the IE browser under Internet Settings >> Settings >> LAN Settings, and it also doesn't show any proxy settings. So, I believe I am not behind any proxy server.


I checked the internet but didn’t get any solutions, so I opened an issue on GitHub and in the NPM community.
https://github.com/SharePoint/sp-dev-docs/issues/3266
https://npm.community/t/sharepoint-spfx-npm-install-error-using-node-8-15-0/4645



The default value of the "proxy" and "https-proxy" keys of the NPM config is NULL. After doing some more R & D, I tried to set the proxy setting value to the above key (this solution works in my scenario).

npm config set proxy http://n****500:8080
npm config set https-proxy http://n****500:8080




After successful execution of the above command, a .nmprc file will be created at C:\Users\username. The file created will be hidden, so make sure to check the "Hidden items" checkbox in the ribbon.



Also, the same proxy settings need to be applied as shown below.

Conclusion: In corporate or some environments, the proxy is a somewhat mandatory setting; otherwise, NPM install will not work.



🚀 "Happy Coding" 🚀