# cp_electron_vue3 **Repository Path**: cp218/cp_electron_vue3 ## Basic Information - **Project Name**: cp_electron_vue3 - **Description**: electron+vue3 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-03 - **Last Updated**: 2021-09-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README > vue3.0 + electron 安装出现异常: ``` npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js` ``` 网速不好或者版本过高,用淘宝镜像安装 ``` npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass ``` 以下异常 ``` > vue-electron@0.1.0 postinstall D:\work\test\vue-electron > electron-builder install-app-deps Error: Cannot find module 'fs/promises' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (D:\work\test\vue-electron\node_modules\builder-util\src\fs.ts:4:1) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) at Function.Module._load (internal/modules/cjs/loader.js:585:3) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at Object. (D:\work\test\vue-electron\node_modules\builder-util\src\util.ts:24:1) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vue-electron@0.1.0 postinstall: `electron-builder install-app-deps` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the vue-electron@0.1.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\82506\AppData\Roaming\npm-cache\_logs\2021-07-07T01_56_37_763Z-debug.log ERROR command failed: npm install --loglevel error ———————————————— 版权声明:本文为CSDN博主「一捆铁树枝」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_41725450/article/details/118539841 ``` 出行这个错误的原因是nodejs版本(我当前的版本12)太低导致的,查看electron-builder的代码可以发现,里面都是require(“fs/promises”)这样的引用,但是旧版nodejs是require(“fs”).promises的引用方式; 解决方法: 通过升级nodejs的方式解决,本人在win10系统下升级为nodejs14,升级后再初始化重新初始化项目就可以正常运行了 项目启动异常 ``` INFO Launching Electron... Failed to fetch extension, trying 4 more times Failed to fetch extension, trying 3 more times Failed to fetch extension, trying 2 more times ... ``` 这是因为在请求安装vuejs devtools插件。需要kexue上网才能安装成功。如果不能kexue上网也没关系,耐心等待5次请求失败后会自动跳过。 每次启动的时候都需要等到请求安装vuejs devtools插件,这个等待时间会比较长,可以通过去掉加载vuejs devtools插件代码来实现: ``` //请求安装vuejs devtools插件,项目启动会很慢,注释掉 //import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer' ```