What steps should I take to troubleshoot and resolve the connection issue that arises while trying to execute npm install

Following the guidelines from: https://www.electronjs.org/docs/tutorial/first-app

I executed commands like mkdir, cd, and npm init. They all ran successfully, generating a file named package.json.

Subsequently, I entered npm install --save-dev electron which resulted in an error occurring.

lala@ubu:~/projects/electron/my-app 17:20:34
$ npm install --save-dev electron

> [email protected] postinstall /home/lala/projects/electron/my-app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

...

<p>After following the above steps, a folder named <code>node_modules along with a file called package-lock.json appeared.

It seemed that the dependencies were successfully installed. However, a connection error occurred--I couldn't access github.com(13.250.177.223) directly, but my proxy was functioning properly.

I configured my proxy settings as follows, but the connection issue persisted.

My ~/.bashrc

export HTTP_PROXY=http://127.0.0.1:8123/
export HTTPS_PROXY=http://127.0.0.1:8123/
export http_proxy=http://127.0.0.1:8123/
export https_proxy=http://127.0.0.1:8123/
$ cat ~/.npmrc 
proxy=http://127.0.0.1:8123/
http-proxy=http://127.0.0.1:8123/
https-proxy=http://127.0.0.1:8123/
noproxy=localhost,127.0.0.1,192.168.,10.
strict-ssl=false

Node version: v12.14.1, NPM version: 6.13.7

How can I resolve this connection error?

Any help would be greatly appreciated!

Answer №1

Follow these steps to successfully install the electron node module while working behind a proxy server.

npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://username:password@host:8080 npm install -D electron@latest
  • In this command, replace username:password with your network credentials if required.
  • Make sure to change host:8080 to match your proxy server's host name and port number.
  • cross-env is an additional node module that can help support command line variables (though it is optional).

Answer №2

Success with this method!

npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=http://localhost:3128 npm install electron

Reference:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The autofocus feature on the textarea in Angular Material Dialog seems to be malfunctioning

Within a web app, I am utilizing the Dialog component from Angular Material. The Dialog consists of only a textarea that is initially empty. I aim to automatically focus on the textarea when the user opens the modal dialog. How can I achieve this? Despite ...

Add a variable from a callback function in AJAX's success response

Is there a way to effectively utilize the variable in the appended message of the AJAX success call? http://codepen.io/anon/pen/fdBvn data['name'] = $('#goofy').val(); $.ajax({ url: '/api/1/email/test/', data: data, type ...

Uncovering the Power of Mongoose: Maximizing MongoDB with Advanced Search Queries

I need to create a search query that can have a maximum of 5 parameters, but could include any number of the following 5 parameters: 01.name_or_number 02.from_date 03.to_date 04.is_validated 05.is_premium Currently, I am able to c ...

Node cannot be updated because npm is not compatible with Node.js version 5.3.0

Running MacOS Sierra v10.12.6, I executed the command npm update -g and received the following result: npm WARN npm npm does not support Node.js v5.3.0 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make ...

Deciding Between Promises and Callbacks in Node.js

As I update my older Node.js code, I am also creating new modules to integrate with the existing code. One challenge I face is transitioning from using callbacks to utilizing ES6 promises more frequently. This has created a mixture of functions that return ...

What advantages could learning ReactJS first give me before diving into NextJS?

Just mastered TS and now faced with the decision of choosing a framework. I'm curious why it's recommended to learn ReactJS before NextJS. I've read countless articles advising this, but no one seems to delve into the reasons behind it. Ca ...

Adding additional parameters to route handlers in Express

I'm new to using Express and I'm interested in finding a way to increase the reusability of routes. In my application, I anticipate having numerous routes that can be handled by a common function but with different templates. For example: app.g ...

"The issue with AngularJS ng-init, preventing the initialization of a variable at

For my project, I have implemented ng-repeat from the AngularJS directive to display an array containing JSON values with subarrays. <div ng-repeat="data in MENULIST" > //MENULIST contains an array of data I then perform certain conditions checks ...

Application of id missing on all buttons in Bootstrap tour template

I'm having an issue with applying a new id to the next button in a Bootstrap tour template. I added the id to the button, but it only seems to work for the first stage and not the subsequent ones. Can anyone provide insight into why this might be happ ...

What is the process for uploading files with just node.js?

My dilemma involves a webpage featuring a form with a file input field. Upon submitting the form, I wish for the server to write the file on the server side. Despite numerous attempts to upload various test images using this form, each results in a plain ...

What is the method for modifying the chosen color using a select option tag instead of a list?

element, I have a Vue component that features images which change color upon clicking a list item associated with that color. <div class="product__machine-info__colors"> <ul> <li v-for="(color, index) in machine.content[0] ...

Is it advisable to incorporate the entire bower_components and node_modules directories into my website development project?

Whenever I download a package using bower or npm, I often find that many unnecessary files are also included, particularly in npm packages. Typically, I only require the .css or .js files from the package, such as in the case of Bootstrap, etc. However, ...

What is the best way to insert an image in front of text within a table cell that can be identified by its class name?

JavaScript Question: function addFlags(){ while(i < $('.tabledata').length){ var current_val = $('.tabledata').eq(i).text(); arr.push(current_val); $('.tabledata').eq(i).html("<img s ...

The Appsheet algorithm determined the exact expiration date as 2 days from the specified date

In my Appsheet, I have two columns: Production Date and Expired Date. If the Production Date is 35 months before the Expired Date, how can I create a formula in Appsheet to calculate this? For example, if the Production Date is 01/10/2023, then the Expired ...

The combination of useEffect and Client component has the power to greatly

As a newcomer to React development, I've encountered a blocking error in my code that isn't being detected by Visual Studio Code. Here's the code snippet for my NavBar component: import React, { useState, useEffect } from "react"; import Ima ...

What is the best way to identify when the soft-keyboard is hidden in the Android browser

Having trouble with the Android Webkit browser and need to manually detect when the soft-keyboard is hidden by pressing the button in the top right corner. https://i.stack.imgur.com/x11Vp.jpg In the image above, pressing the button hides the soft keyboar ...

Improved Node.js algorithm designed to identify anagrams of a specific string in an array. The approach must not rely on generating all possible subsets to find the anagram of the string

I am looking to create a collection of anagram pairs within an array. The input will consist of the initial array of strings. For example: let inputArray = ["abcd", "dbac", "adfs", "adsf", "bDca"]; This program should consider the case of the letters, m ...

Tips for generating a document and adding information from an HTML webpage?

My desktop has an html file which requires input. How can I save this input to a file on my computer? Do I need to use a different language like python or javascript, and if so, how do I do it? Additionally, is there a way for javascript to launch an app ...

Refresh the Angular view only when there are changes to the object's properties

I have a situation where I am fetching data every 15 seconds from my web API in my Angular application. This continuous polling is causing the Angular Material expansion panel to reset to its default position, resulting in a slow website performance and in ...

Leverage node-video-lib alongside buffer functionality

I'm exploring how to utilize the library node-video-lib for retrieving information about a video received on the server. However, the documentation only provides examples of working with files from the file system: Here is an example from the documen ...