npm run dev 项目,提示

throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')

根据提示删除electron包,重新安装一次,还是提示错误

单独安装electron

npm install electron -g
C:\Users\pxm\AppData\Roaming\npm\electron -> C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\cli.js

> core-js@3.6. postinstall C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\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 -) > electron@8.0. postinstall C:\Users\pxm\AppData\Roaming\npm\node_modules\electron
> node install.js (node:) UnhandledPromiseRejectionWarning: HTTPError: Response code (Not Found) for http://npm.taobao.org/mirrors/electron/v8.0.3/electron-v8.0.3-win32-x64.zip
at EventEmitter.<anonymous> (C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\node_modules\got\source\as-stream.js::)
at EventEmitter.emit (events.js::)
at module.exports (C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\node_modules\got\source\get-response.js::)
at ClientRequest.handleResponse (C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\node_modules\got\source\request-as-event-emitter.js::)
at Object.onceWrapper (events.js::)
at ClientRequest.emit (events.js::)
at ClientRequest.origin.emit (C:\Users\pxm\AppData\Roaming\npm\node_modules\electron\node_modules\@szmarczak\http-timer\source\index.js::)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js::)
at HTTPParser.parserOnHeadersComplete (_http_common.js::)
at Socket.socketOnData (_http_client.js::)
(node:) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+ electron@8.0.
added packages from contributors in .606s

提示 http://npm.taobao.org/mirrors/electron/v8.0.3/electron-v8.0.3-win32-x64.zip 无法访问

项目用到的electron 版本v7.1.14,试了 https://npm.taobao.org/mirrors/electron/v7.1.14/electron-v7.1.14-win32-x64.zip 也不行

去淘宝electron镜像,找到window 64位的electron,对应的地址是https://cdn.npm.taobao.org/dist/electron/7.1.14/electron-v7.1.14-win32-x64.zip

所以原因是地址问题,导致上面的错误

官方也给出原因:淘宝镜像的问题

同时官方给出的解决方法

例如,使用中国镜像:

ELECTRON_MIRROR="https://cdn.npm.taobao.org/dist/electron/"

设置electron 镜像源地址:

npm config set electron_mirror https://cdn.npm.taobao.org/dist/electron/

参考:

Electron 8.0.2 Install Failed Because Of Wrong Download URL Path #22480

Electron failed to install correctly, please delete node_modules/electron and try installing again #20994

Electron 文档-安装

淘宝electron镜像

npm run dev启动项目,electron提示throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')的更多相关文章

  1. Electron桌面项目-解决throw new Error('Electron failed to install correctly, please delete node_modules..

    前言 Electron 是一个用 HTML,CSS 和 JavaScript 来构建跨平台桌面应用程序的一个开源库.由GitHub开发的. 其原理是 Electron 通过将 Chromium 和 N ...

  2. npm run dev 启动项目报错我的解决办法

    我的报错截屏 解决方案   1.    config文件中 index 文件中的 host 值如果是数字串就将其改为 localhost 2.    再次尝试 如果有遇到其他问题阔以将 node-mo ...

  3. npm run dev启动项目报错 Cannot find module 'webpack-cli/bin/config-yargs'

    一般是webpack的版本和webpackserver的版本不兼容导致的错误. 解决方法是先卸载这两个版本,再安装指定的版本. 卸载: 再安装指定或者最新版本的webpack和webpack-dev- ...

  4. vue中npm run dev运行项目不能自动打开浏览器! 以及 webstorm跑vue项目jshint一直提示错误问题的解决方法!

    vue中npm run dev运行项目不能自动打开浏览器!以及 webstorm跑vue项目jshint一直提示错误问题的解决方法! 1.上个项目结束就很久没有使用vue了,最近打算用vue搭建自己的 ...

  5. vue中npm run dev运行项目自动打开浏览器

    npm run dev运行项目自动打开浏览器设置自动打开浏览器 // 各种设备设置信息      host: 'localhost', //主机名      port: 8080, // 端口号(默认 ...

  6. Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法

    Laravel 5.4 Mix & Laravel5.5执行 npm run dev时报错,提示cross-env找不到(not found)的解决办法   首先进入package.json文 ...

  7. VUE npm run dev 启动时,报了一大堆错误 Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 7.x

    npm run dev 启动时,报了一大堆错误 Module build failed: Error: Missing binding E:\2017VocaSchool\vocationWeb\no ...

  8. 巨坑npm run dev 报错 终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build/css/add.p

    Windows10环境 npm run dev 报错  终于找到正确答案 Error: EPERM: operation not permitted, open '/data/public/build ...

  9. vue-cli webpack项目npm run dev启动过程

    前言 通过vue init webpack和npm install命令初始化项目后,执行npm run dev就打开了网站http://localhost:8080.初学者不知道index.html. ...

随机推荐

  1. Java创建线程的方式

    Java中线程的创建有四i种方式: 1.  通过继承Thread类,重写Thread的run()方法,将线程运行的逻辑放在其中 2.  通过实现Runnable接口,实例化Thread类 3.应用程序 ...

  2. C# 操作Orcle数据库

    1.首先添加NuGet:Oracle.ManagedDataAccess 2.配置连接数据库字符串:Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(H ...

  3. python—day01_环境安装

    搭建环境 1.win10_X64,其他Win版本也可以. 2.安装python.()3.PyCharm版本:Professional-2016.2.3. 在Windows上安装Python 首先,根据 ...

  4. 记一次 React Native 大版本升级过程——从0.40到0.59

    去年把公司几个react native 相关的项目升级了下,已经过去一段时间了,这里系统整理下之前的整个过程. 背景 之前到公司的时候发现公司用的还是0.40的版本,据了解,当时项目做的比较早,导航用 ...

  5. 一文讲透Modbus协议

    前言 Modbus是一种串行通讯协议,是Modicon公司(现在的施耐德电气 Schneider Electric) 于1979年为使用可编程逻辑控制器(PLC)通信而发表.Modbus已经成为工业领 ...

  6. wordpress获取文章特色图像路径函数wp_get_attachment_image_src()

    特色图像是wordpress主要的文章缩略图功能,几乎全部wordpress模板都使用或支持特色图像.今天介绍的wp_get_attachment_image_src()函数就是获取文章特色图像路径的 ...

  7. Java 对象的封装,继承,抽象,接口写法

    面向对象的封装写法        关键字 private class A    {        private int a=1;        private void work()         ...

  8. 通过adb调试Unity开发的安卓应用

    命令: 1. adb logcat -s Unity 2. adb | grep Unity

  9. [COCOS2DX-LUA]0-004.cocos2dx中的DrawNode的init的方法问题

    1.诱因 近期,项目接入了Bugly, 上报了一些平常测试不出来,或者很难重现的bug,这类bug非常难排查.原因有二,第一,问题无法重现,第二,修改了无法立即验证结果.有一个问题困恼了我很久,就是一 ...

  10. [JavaWeb基础] 013.Struts2 自定义类型转换器

    很多时候,我们在做web开发的时候经常要用到时间的转换器,Struts2给我们提供了一种类型转换器的接口.下面我们讲讲怎么实现吧. 1.首先我们要定义一个类型转换的类,继承自com.babybus.s ...