简体   繁体   中英

Build issue in electron application

I have build a simple app using electron and its works fine when you launch with npm start . After i am try to deploy my application, I am getting following error.

WARNING: --asar does not take any arguments, it only has sub-properties (see --help) Packaging app for platform win32 ia32 using electron v4.1.3 WARNING: Found 'electron' but not as a devDependency, pruning anyway rcedit.exe failed with exit code 1. Reserved header is not 0 or image type is not icon for 'a' Fatal error: Unable to set icon npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! shoppinglist@1.0.0 package-win: electron-packager . electron-tutorial-app --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="ShoppingList" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the shoppinglist@1.0.0 package-win script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.`

I already tried npm cache clean --force and install node modules again by npm install did't worked in my case. can anyone help me with this please?

package.json

{
  "name": "shoppinglist",
  "version": "1.0.0",
  "description": "Electron shoppinglist desktop app",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "package-mac": "electron-packager . --overwrite --platform=darwin --arch=x64 --icon=assets/icons/mac/icon.icns --prune=true --out=release-builds",
    "package-win": "electron-packager . --overwrite --asar=true --platform=win32 --arch=ia32 --icon=assets/icons/win/icon.ico --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName=\"Shopping List\"",
    "package-linux" : "electron-packager . --overwrite --platform=linux --arch=x64 --icon=assets/icons/png/icon.png --prune=true --out=release-builds"
  },
  "license": "ISC",
  "dependencies": {
    "electron": "^1.7.6"
  },
  "devDependencies": {
    "electron-packager": "^9.0.1"
  }
}

This can be happen for some reason your cache gets corrupted with some conflicting versions of different dependencies but in your case, you have already run npm cache clean and reinstalled all the node modules.

Please check folder paths that you have given to the package.json . This might fix your problem.

I have also faced this kind of problem. I have move the electron dependency from dependencies to devDependencies in order to solve the problem.It works for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM