Introduction
In this article, I will explain how you can resolve the issue where NMP packages are not getting installed because of corporate network proxy.
Description
While setting up the development environment for SharePoint Server 2019 in Windows Server 2019, firstly I installed Node version 8.17.0, as it's the recommended Node version for SharePoint Server 2019 on-premise. After that, tried to install the Gulp using the command - npm install [email protected] --global, however getting the below error which states that - "This is a problem related to network connectivity. If you are behind a proxy, please make sure that the 'proxy' config is set properly."
The above error suggests that you need to configure NPM or development environment behind a corporate proxy mainly the proxy & http-proxy settings.
Issue Resolution
For resolving the NPM related issues behind a corporate network proxy, run the below commands in command prompt and then you will be able to install the NPM packages.
Note
- Skip the my
username:mypassword
part if proxy doesn't require you to authenticate.
- In addition, if your password contains some special characters, then enter those special characters with HTML encoding (e.g. - for $ in password, use %24).
- On Windows, you can find the proxy settings in the Internet Explorer ➡️ Internet Options ➡️ LAN Settings for your connection, under the Proxy server configuration.
- The above commands will update or create the .npmrc configuration file in the root of your profile (if it doesn’t already exist). NPM will use this configuration file when you try to install NPM packages.
- SharePoint Server 2019 supports SharePoint Framework client-side web parts hosted on classic or modern SharePoint pages built by using the SharePoint Framework v1.4.1.
- In Node.js v8.x, you can force HTTP1 by setting the environment variable to instruct Node.js to use HTTP1 instead of the default HTTP2:
NODE_NO_HTTP2=1
.
I ran the above commands and was able to install Gulp, Yeoman and other dependencies which are required for SharePoint Framework (SPFx) development, as shown in below image -
References