[electron] package bug summary

Time:2020-11-7

electron-builder

Error: Unresolved node modules: bufferutil, utf-8-validate

[electron] package bug summary

Solution

Scheme 1

takeelectron-builderPackage upgrade to the latest version22.9.1

npm uninstall electron-builder
// or yarn remove electron-builder
npm i electron-builder -D
// or yarn add electron-builder -D

Scheme 2

download[email protected]put tonode_modulesDirectory, and manually install the dependency

// node_modules/electron-builder
npm i 
// or yarn

Scheme 3

Delete localelectron-builderUse globalelectron-builderTo pack

// project
npm uninstall electron-builder
// or yarn remove electron-builder
npm i -g electron-builder
// or yarn add global http-server

Thinking of problem solving

Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime.

  1. Although the bug is given a lack of hintsbufferutil, utf-8-validateTwo packages, but it’s actuallyapp-builder-libPackage issues
  2. When you try to install these two packages and still report the problem, we need to solve the person who raised the problem. After all, this is the fastest solution
  3. When you enterapp-builder-libIt’s not hard to find it in the directory,app-builder-libNot in the catalogsrcThis catalog
  4. So what should we do now? We should find other ways, such aselectron-builderWe can download the global package first and then package ityarn add global electron-builder, and then executeelectron-builder --dirTo test a package, found that it can be packaged
  5. Then the problem can be basically locked in the package dependency. The fastest solution is to use the latest package directly, but some projects can not use the latest package. What we should do is
  6. gonpmjsFind the corresponding package, and then

[electron] package bug summary
adoptRepositoryAccess to the packagegithubHome page,
[electron] package bug summary

adopttagsFind the corresponding version of the package, download it and put it into thenode_modulesDirectory, manually install the dependency to use

  1. At this point, you need to pay attention to the bagspackage.jsonIs the corresponding version in the same as the one you installed

[electron] package bug summary

  1. Finally, look at the corresponding documents to find out who raised the questionpeopleAnd then you can basically determine where the problem is (at present, the problem cannot be repeated in the future. After solving it, I tried to reproduce the problem, but found that20.19.2In the absence of this problem, there is only a screenshot, which is also obtained from my partner) at presentwindowsuseelectronGenerally speaking, the experience is not very good. The probability of persuading new people to quit is still very large. If you have any questions, please discuss them together

recommend

vue + electron

electron-vue

If you need to calldllOr usewinaxA kind of package that needs to be compiled is still recommendedelectron-vueAt least you will encounter fewer problems. If you like challenges, recommend itvue-cli-plugin-electron-builder

vue-cli-plugin-electron-builder

If you just need onechromeIt is recommended that you use itvue-cli-plugin-electron-builderAt the same timevuetifyUse, the effect is better
For example, my open source project:weChatTool

Of course, I still like itvue-cli-plugin-electron-builder