自学内容网 自学内容网

@quick-start/electron安装过程中的问题解决

node 的版本是 18.18.2
使用的安装命令

npm create @quick-start/electron myelectron

package.json 文件

{
  "name": "myelectron",
  "version": "1.0.0",
  "description": "An Electron application with Vue",
  "main": "./out/main/index.js",
  "author": "example.com",
  "homepage": "https://electron-vite.org",
  "scripts": {
    "format": "prettier --write .",
    "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
    "start": "electron-vite preview",
    "dev": "electron-vite dev",
    "build": "electron-vite build",
    "postinstall": "electron-builder install-app-deps",
    "build:unpack": "npm run build && electron-builder --dir",
    "build:win": "npm run build && electron-builder --win",
    "build:mac": "npm run build && electron-builder --mac",
    "build:linux": "npm run build && electron-builder --linux"
  },

  "build": {
    "extraResources": [
      "./assets/**"
    ],
    "productName": "EasyChat",
    "appId": "com.easychat",
    "directories": {
      "output": "installPackages"
    },
    "nsis": {
      "oneClick": false,
      "allowElevation": true,
      "allowToChangeInstallationDirectory": true,
      "installerIcon": "./resources/icon.ico",
      "uninstallerIcon": "./resources/icon.ico",
      "installerHeaderIcon": "./resources/icon.ico",
      "createDesktopShortcut": true,
      "createStartMenuShortcut": true,
      "shortcutName": "EasyChat"
    },
    "mac": {
      "icon": "icons/icon.icns"
    },
    "win": {
      "artifactName": "${productName}Setup.${version}.exe",
      "icon": "resources/icon.ico",
      "target": [
        "nsis"
      ]
    }
  },
  
  "dependencies": {
    "@electron-toolkit/preload": "^2.0.0",
    "@electron-toolkit/utils": "^2.0.0",
    "@imengyu/vue3-context-menu": "^1.3.8",
    "axios": "^1.6.2",
    "dplayer": "^1.27.1",
    "electron-store": "^8.1.0",
    "element-plus": "^2.4.3",
    "express": "^4.18.2",
    "fluent-ffmpeg": "^2.1.2",
    "fs-extra": "^11.2.0",
    "js-md5": "^0.8.3",
    "moment": "^2.30.1",
    "pinia": "^2.1.7",
    "sass": "^1.69.5",
    "sass-loader": "^13.3.2",
    "sqlite3": "5.1.6",
    "v-viewer": "^3.0.11",
    "vue-cookies": "^1.8.3",
    "vue-router": "^4.2.5",
    "ws": "^8.16.0"
  },
  "devDependencies": {
    "@electron-toolkit/eslint-config": "^1.0.1",
    "@rushstack/eslint-patch": "^1.3.3",
    "@vitejs/plugin-vue": "^4.3.1",
    "@vue/eslint-config-prettier": "^8.0.0",
    "asarmor": "^2.0.0",
    "electron": "^25.6.0",
    "electron-builder": "25.1.8",
    "electron-vite": "^1.0.27",
    "eslint": "^8.47.0",
    "eslint-plugin-vue": "^9.17.0",
    "less": "^4.2.0",
    "node-gyp": "^10.0.1",
    "prettier": "^3.0.2",
    "vite": "^4.4.9",
    "vue": "^3.3.4"
  }
}

可以看到 package.json 文件中有 “sqlite3”: “5.1.6”, 的依赖
于是当我们 npm install的时候就会卡在 这个位置不动了
在这里插入图片描述

上面的问题的解决办法如下
首选 下载 visual studio 传送门
下载得到一个在线的安装包
在这里插入图片描述
双击安装
在这里插入图片描述
选择以上的安装, 安装完成之后

我们重新进入 myelectron 项目中, 再次 npm i 就可以了

在这里插入图片描述


原文地址:https://blog.csdn.net/hjh15827475896/article/details/143841764

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!