1:When packaging, the download resource timed out:

  1. # Use domestic sources, see the tutorial of installing or generating software

2:packaging failed (exception)

  1. error 1pyton ......
  2. solutionupgrade build packnpm install electron-builder@23.0.6
  1. error 2Packing error, Fatal error: Unable to commit changes
  2. reason
  3. 1. Is the disk full? This pit also bothered me for half an hour. Although it's not long, it's a low-level error
  4. 2. Antivirus software, I'll just turn off the computer steward, McFee, mcfeina antivirus and so on.
  5. 3. When using the makensis package, the account name is Chinese, and the construction is abnormal.
  6. solution:
  7. 1. Clean disk
  8. 2. Exit antivirus software
  9. 3. https://www.azimiao.com/6250.html
  1. error 3:...resource\app.asar does not exist ...
  2. solutionIf there is an app directory in the electron-egg directory, the directory must be an ordinary file directory, not a project directory,
  3. For example, there cannot be .git, package.json or node_modules files in the app directory.
  1. error 4:...Need executable 'ar' to convert dir to deb
  2. reasonfpm tool need ar commond, To pack deb, install binutils
  3. solutionsudo apt install binutils

3:After packaging, run flashback or report an error

flash back

  1. # The development mode is normal, and the operation flashes after packaging
  2. 1. Check whether there is any error in the log
  3. 2. Run the program in CMD, and you can see whether there are abnormal errors in the running of the packaged program (none in the log)
  4. such asd:/soft/electron-egg.exe click Enter

error 1: The code is filtered.

C_BMLY4)N`_VF600EF4M9ZU.jpg
This figure shows./app.asar/electron not exits
cause: The encryption function is not used, but the source code is filtered, resulting in no code found.
Processing: View code encryption documentation

error 2:bytecode,Code is not standard

0E209~Q363%UON52RU`U3HG.png
The figure shows: TypeError Class constructor ExampleService cannot be invoked withou ‘new’ at ……
cause:For each encrypted class file, the toString() method needs to be added
Processing:see Code encryptionCode requirements

4:garbled cmd console

see: chinese garbled

5:The npm package is missing or abnormal.

When the installation is abnormal, delete node_modules and package-lock file

  1. # 1: cannot find module 'debug'
  2. solutionnpm install debug --save
  3. # 2: npm install (When the installation is abnormal)
  4. delete package-lock.json
  5. delete node_modules
  6. Rerun 'npm install or cnpm install'

6:white screen, api 404, cross-issue

  1. # dev 404
  2. solution 1Start the front-end service first, and then start the desktop service. Please check the development steps in the document
  3. # Agent used
  4. reason 2:代理导致api找不到
  5. solution
  6. 1Change the proxy mode to the environment variable mode. For example, define multiple URL variables in the. Env (development environment, production environment) file and assign values.
  7. The URL address in the code Replace with environment variables.
  8. 2set config.default.json, windowsOption.webPreferences.webSecurity=true

7:failed to install the better-sqlite3.

  1. # error 1
  2. ......
  3. env: python: No such file or directory
  4. make: *** [Release/sqlite3.a] Error 127
  5. rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
  6. gyp ERR! build error
  7. gyp ERR! stack Error: `make` failed with exit code: 2
  8. gyp ERR! stack at ChildProcess.onExit (/Users/apple/.nvm/versions/node/v14.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
  9. ......
  10. # reason
  11. requirements python3
  12. # solution
  13. such as MacOS
  14. 1. brew install python@3.9
  15. 2. vim ~/.zshrc add
  16. # python
  17. alias python='/usr/local/bin/python3'
  18. export PATH="/usr/local/opt/python@3.9/libexec/bin:$PATH"
  19. 3. source ~/.zshrc
  1. # error 2
  2. ......
  3. gyp ERR! build error
  4. gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
  5. gyp ERR! stack at ChildProcess.onExit (C:\nvm\v14.16.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
  6. gyp ERR! stack at ChildProcess.emit (events.js:315:20)
  7. gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
  8. gyp ERR! System Windows_NT 10.0.19041
  9. gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\nvm\\v14.16.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
  10. gyp ERR! cwd D:\www\xing\oschina-desktop\node_modules\better-sqlite3
  11. ......
  12. # reason
  13. requemments node-gyp tool
  14. # solution
  15. Rerunnpm i node-gyp -g
  1. # error 3
  2. ......
  3. was compiled against a different Node.js version using
  4. NODE_MODULE_VERSION 83. This version of Node.js requires
  5. NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
  6. ......
  7. # reason
  8. SQLite package is written in C \ C + +. The downloaded executable program may be inconsistent with your operating system, so it needs to be rebuilt according to the source code.
  9. # solution
  10. Rerun: npm run re-sqlite

8:Open the vue service address in the browser ( http://localhost:8080 ) error

  1. error Uncaught TypeError: window.require is not a function......
  2. reasonThere is a demo function in Vue project that needs to access the electron module, which cannot be parsed in ordinary browsers
  3. solutionTry to debug the front-end page in the window started by electron.

9: in the development mode, the front-end code cannot be automatically updated on the electron-egg rendering interface.

  1. click electron-egg menu->View->Reload

10:The node module version does not match.

  1. # error
  2. ......
  3. was compiled against a different Node.js version using
  4. NODE_MODULE_VERSION 83. This version of Node.js requires
  5. NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
  6. ......
  7. # reason
  8. Some NPM packages are written in other languages such as C \ C + +. The downloaded executable program may not be consistent with your operating system, so it needs to be rebuilt according to the source code.
  9. # solution
  10. electron-rebuild -f -w 'module name'

11:automatic update failed in macOS

  1. // Try to turn off asar
  2. 1. Check and confirm Apple signature account
  3. 2. Modify the asar attribute value of the build object to false in package.json
  4. 3. Use code encryption to prevent source code exposure

12:Software black screen or stuck

  1. error ... ERROR:gpu_memory_buffer_support_x11.cc......
  2. reasonwin7 or LinuxGPU acceleration is not supported
  3. solutionTurn off hardware acceleration in the ready() method of the main.js file
  4. Pseudo code
  5. const isWin7 = os.release().startsWith('6.1');
  6. const isLinux = true;
  7. if (isWin7 || isLinux) {
  8. app.disableHardwareAcceleration();
  9. }