Solution for unsuccessful installation of electron using npm

Solution for unsuccessful installation of electron using npm

According to the npm installation method of electron provided by the official website, use the following command to install, but the result is unsuccessful

npm install --save-dev electron-prebuilt
  • 1

The error prompt electron-prebuilthas been renamed electronand re-used npm install --save-dev electronto install, but it is still unsuccessful.

By consulting relevant information, I learned that it may be due to the inaccessibility of foreign mirrors, so domestic mirrors are used for installation. The well-known npm mirror in China is

Taobao npm mirror 
https://npm.taobao.org/

It can be installed from Taobao NPM with the following command

npm install -g package --registry=https://registry.npm.taobao.org
  • 1

You can also use the cnpm developed by Taobao NPM to install the package

//首先安装cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org

//使用cnpm进行安装,使用方法和npm相同
cnpm install -g electron
  • 1
  • 2
  • 3
  • 4
  • 5

However, whether you use npm to install through Taobao mirror or install through cnpm, you can successfully complete the installation of electron (original electron-prebuilt).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326256748&siteId=291194637