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" 🚀

5 comments:

  1. the value of the proxy, is that I need to check with my network administrator, or I can add anything?

    ReplyDelete
  2. You cannot add any value as proxy.
    Ask for proxy settings value to your IT/networking team. When you got proxy value, first try to apply them in IE networking settings and check if internet is working or not. If yes then set npm config proxy value.

    ReplyDelete
  3. What could be proxy value for independent user?I'm not working in any company. I'm getting this error on my personal laptop.

    ReplyDelete
  4. First check the Local Area Network (LAN) Settings of the Internet Explorer. "Automatically detect settings" option should be checked in your case as you as not using any type of proxy setting, then check if internet is accessible in IE browser.

    Open the Command Prompt in Run as administrator mode and try again "npm install -g yo gulp".

    ReplyDelete
  5. Nice article. It's very helpful to me. Thank you for share with us. Can you please check my article npm ERR! Unexpected end of JSON input while parsing near ‘…10.0″,”grunt-contrib-‘

    ReplyDelete