[Solved] electron project Package Error: spawn exe\dll ENOENT

Error after electron packaging: spawn exe enoent error solution.

Today, an error occurred when the project was running after packaging: spawn exe enoent error. When looking for a solution, I thought it should be that the referenced exe program was packaged into the app It is caused by the ASAR file, so the EXE file is not packaged into the app ASAR files should solve the problem.

I packed it with electron builder in Vue config.JS file, in Vue config.JS add the following code

pluginOptions: {
		electronBuilder: {
			builderOptions: {
				asar: true,
				asarUnpack: ['exeFiles'],//The folder where the referenced dll/exe files are stored
				extraFiles: {
					from: 'exeFiles',// the folder where the referenced dll/exe files are stored, my project is in the same directory as vue.config.js
					to: '. /exeFiles'//the location of the folder after packaging, I packaged this way before and after the reference relationship does not change, spawn code will not have to change
				},		
		}
	}

If you use the older version of Vue cli, it should be in package JSON, the principle is similar.

Read More: