SharePoint SPFX: npm install error using node 8.15.0

cli

(Vikas Bansal) #1

Getting error while installing “npm install -g yo gulp” cmd.

Please find attached log file and snapshot for the error.
2019-01-14T12_42_47_222Z-debug.log (2.4 KB)

It gets struck and freezes.
After sometime this error popup

As per the error message attached by me, its due to proxy server. But I am not using any proxy. I’m in a corporate network. But when I check the internet settings >>LAN settings it doesn’t show any proxy server. So, I believe I am not behind any proxy server.

What I Wanted to Do

Want to setup SPFX development environment using- https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment

What Happened Instead

Unable to install npm dependencies- yo and gulp

Reproduction Steps

Follow the steps mentioned in the setup URL shared

Details

node -v 8.15.0
npm -v 6.4.1

Platform Info

$ npm --versions
{
  npm: '6.4.1',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.33.0',
  node: '8.15.0',
  openssl: '1.0.2q',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.23.2',
  v8: '6.2.414.75',
  zlib: '1.2.11'
}

$ node -p process.platform
  win32

(Vikas Bansal) #2

Solution : The default value of ‘proxy’ and ‘https-proxy’ key of npm config is NULL. After doing some more R & D then I tried to set the proxy setting value to above key (this solution works in my scenario).

Also, the same proxy settings need to be applied in IE browser Internet Settings >> Settings >> LAN settings.

Conclusion : In corporate/some environment the proxy is a somewhat mandatory setting otherwise npm install will not work.

Issue on GitHub: https://github.com/SharePoint/sp-dev-docs/issues/3266

You can refer blog for detailed information https://blogs2share.blogspot.com/2019/01/spfx-environment-setup-error.html