- 1:When packaging, the download resource timed out:
- 2:packaging failed (exception)
- 3:After packaging, run flashback or report an error
- 4:garbled cmd console
- 5:The npm package is missing or abnormal.
- 6:white screen, api 404, cross-issue
- 7:failed to install the better-sqlite3.
- http://localhost:8080 ) error">8:Open the vue service address in the browser ( http://localhost:8080 ) error
- 9: in the development mode, the front-end code cannot be automatically updated on the electron-egg rendering interface.
- 10:The node module version does not match.
- 11:automatic update failed in macOS
- 12:Software black screen or stuck
1:When packaging, the download resource timed out:
# Use domestic sources, see the tutorial of installing or generating software
2:packaging failed (exception)
error 1:pyton ......
solution:upgrade build pack,npm install electron-builder@23.0.6
error 2:Packing error, Fatal error: Unable to commit changes
reason:
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
2. Antivirus software, I'll just turn off the computer steward, McFee, mcfeina antivirus and so on.
3. When using the makensis package, the account name is Chinese, and the construction is abnormal.
solution:
1. Clean disk
2. Exit antivirus software
3. https://www.azimiao.com/6250.html
error 3:...resource\app.asar does not exist ...
solution:If there is an app directory in the electron-egg directory, the directory must be an ordinary file directory, not a project directory,
For example, there cannot be .git, package.json or node_modules files in the app directory.
error 4:...Need executable 'ar' to convert dir to deb
reason:fpm tool need ar commond, To pack deb, install binutils
solution:sudo apt install binutils
3:After packaging, run flashback or report an error
flash back
# The development mode is normal, and the operation flashes after packaging
1. Check whether there is any error in the log
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)
such as:d:/soft/electron-egg.exe click “Enter”
error 1: The code is filtered.
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
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 encryption 中 Code 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: cannot find module 'debug'
solution:npm install debug --save
# 2: npm install (When the installation is abnormal)
delete package-lock.json
delete node_modules
Rerun 'npm install or cnpm install'
6:white screen, api 404, cross-issue
# dev 404
solution 1:Start the front-end service first, and then start the desktop service. Please check the development steps in the document
# Agent used
reason 2:代理导致api找不到
solution:
1:Change 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.
The URL address in the code Replace with environment variables.
2:set config.default.json, windowsOption.webPreferences.webSecurity=true
7:failed to install the better-sqlite3.
# error 1
......
env: python: No such file or directory
make: *** [Release/sqlite3.a] Error 127
rm ba23eeee118cd63e16015df367567cb043fed872.intermediate
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
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)
......
# reason
requirements python3
# solution
such as MacOS
1. brew install python@3.9
2. vim ~/.zshrc add
# python
alias python='/usr/local/bin/python3'
export PATH="/usr/local/opt/python@3.9/libexec/bin:$PATH"
3. source ~/.zshrc
# error 2
......
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\nvm\v14.16.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19041
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"
gyp ERR! cwd D:\www\xing\oschina-desktop\node_modules\better-sqlite3
......
# reason
requemments node-gyp tool
# solution
Rerun:npm i node-gyp -g
# error 3
......
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
......
# reason
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.
# solution
Rerun: npm run re-sqlite
8:Open the vue service address in the browser ( http://localhost:8080 ) error
error :Uncaught TypeError: window.require is not a function......
reason:There is a demo function in Vue project that needs to access the electron module, which cannot be parsed in ordinary browsers
solution:Try 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.
click electron-egg menu->View->Reload
10:The node module version does not match.
# error
......
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 89. Please try re-compiling or re-installing
......
# reason
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.
# solution
electron-rebuild -f -w 'module name'
11:automatic update failed in macOS
// Try to turn off asar
1. Check and confirm Apple signature account
2. Modify the asar attribute value of the build object to false in package.json
3. Use code encryption to prevent source code exposure
12:Software black screen or stuck
error : ... ERROR:gpu_memory_buffer_support_x11.cc......
reason:win7 or Linux,GPU acceleration is not supported
solution:Turn off hardware acceleration in the ready() method of the main.js file
Pseudo code:
const isWin7 = os.release().startsWith('6.1');
const isLinux = true;
if (isWin7 || isLinux) {
app.disableHardwareAcceleration();
}