electronize doesn't add version or description to the package.json it uses in a build. #636

Closed
opened 2026-01-29 16:44:50 +00:00 by claunia · 6 comments
Owner

Originally created by @danatcofo on GitHub (Feb 18, 2021).

Originally assigned to: @GregorBiswanger on GitHub.

Using the latest version (11.5.1)

This is causing a build error for linux targets with a message of Please specify 'version' in the package.json and also causes a warning with message of description is missed in the package.json

Steps to Reproduce:

  1. add a version and description to the package.json in the application
  2. execute electronize /target linux on a linux system (other steps may need to be done here to get linux building correctly)
  3. look at the package.json used during electronize call and notice its not there.

the file used during the electronize call is put in this general location ~/obj/desktop/-encodedCommand/package.json

Originally created by @danatcofo on GitHub (Feb 18, 2021). Originally assigned to: @GregorBiswanger on GitHub. Using the latest version (11.5.1) This is causing a build error for linux targets with a message of `Please specify 'version' in the package.json` and also causes a warning with message of `description is missed in the package.json` Steps to Reproduce: 1. add a version and description to the package.json in the application 2. execute `electronize /target linux` on a linux system (other steps may need to be done here to get linux building correctly) 3. look at the package.json used during electronize call and notice its not there. the file used during the electronize call is put in this general location `~/obj/desktop/-encodedCommand/package.json`
claunia added the bug label 2026-01-29 16:44:50 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Feb 18, 2021):

Since version 8.31.1 we have a feature to set the name and author of the app in electron.manifest.json.

Already tried?

@GregorBiswanger commented on GitHub (Feb 18, 2021): Since version 8.31.1 we have a feature to set the name and author of the app in `electron.manifest.json`. Already tried?
Author
Owner

@danatcofo commented on GitHub (Feb 18, 2021):

that is set just fine, its not the name and the author that is causing any issues, its version/description.

I noticed that name/author was in the output package.json already but didn't comment on it. Honestly I think something changed upstream of us that is now causing electronize to fail on a linux target where it did not before. It exposed something electronize should probably do but isn't.

this is the output of the electronize package.json

something that stand out here... version, description, repository all should be overridable. possibly license as well.

{
   "name":"prefix",
   "version":"",
   "description":"",
   "repository":{
      "url":"https://github.com/ElectronNET/Electron.NET"
   },
   "main":"main.js",
   "author":{
      "name":"Stackify",
      "email":"support@stackify.com"
   },
   "license":"MIT",
   "scripts":{
      "start":"tsc -p ."
   },
   "dependencies":{
      "dasherize":"^2.0.0",
      "electron-updater":"^4.3.5",
      "image-size":"^0.9.3",
      "portscanner":"^2.2.0",
      "socket.io":"^2.4.0"
   },
   "devDependencies":{
      "@types/node":"^10.17.20",
      "@types/socket.io":"^2.1.12",
      "electron":"^11.1.1",
      "tslint":"^6.1.3",
      "typescript":"^4.1.3"
   }
}
@danatcofo commented on GitHub (Feb 18, 2021): that is set just fine, its not the name and the author that is causing any issues, its version/description. I noticed that name/author was in the output package.json already but didn't comment on it. Honestly I think something changed upstream of us that is now causing electronize to fail on a linux target where it did not before. It exposed something electronize should probably do but isn't. this is the output of the electronize package.json something that stand out here... version, description, repository all should be overridable. possibly license as well. ``` { "name":"prefix", "version":"", "description":"", "repository":{ "url":"https://github.com/ElectronNET/Electron.NET" }, "main":"main.js", "author":{ "name":"Stackify", "email":"support@stackify.com" }, "license":"MIT", "scripts":{ "start":"tsc -p ." }, "dependencies":{ "dasherize":"^2.0.0", "electron-updater":"^4.3.5", "image-size":"^0.9.3", "portscanner":"^2.2.0", "socket.io":"^2.4.0" }, "devDependencies":{ "@types/node":"^10.17.20", "@types/socket.io":"^2.1.12", "electron":"^11.1.1", "tslint":"^6.1.3", "typescript":"^4.1.3" } } ```
Author
Owner

@BenjaminVettori commented on GitHub (Feb 25, 2021):

It seems that name, author and version are only written to package.json and package-lock.json, if the "buildVersion" value is set: https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.Host/build-helper.js

electron.manifest.json:

{
  "name": "Example-App",
  "author": "The Author",
  ...
  "build": {
    "appId": "com.my.app",
    ...
    "buildVersion": "1.0.0",
    ...
  },
  ...
}
@BenjaminVettori commented on GitHub (Feb 25, 2021): It seems that name, author and version are only written to package.json and package-lock.json, if the "buildVersion" value is set: https://github.com/ElectronNET/Electron.NET/blob/master/ElectronNET.Host/build-helper.js electron.manifest.json: ```json { "name": "Example-App", "author": "The Author", ... "build": { "appId": "com.my.app", ... "buildVersion": "1.0.0", ... }, ... } ```
Author
Owner

@nakibulshaki commented on GitHub (Aug 30, 2022):

I need to add build version like "1.0.0.9"
but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"'
But when i try "1.0.9" it's works fine

@nakibulshaki commented on GitHub (Aug 30, 2022): I need to add build version like "1.0.0.9" but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"' But when i try "1.0.9" it's works fine
Author
Owner

@BenjaminVettori commented on GitHub (Sep 5, 2022):

I need to add build version like "1.0.0.9" but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"' But when i try "1.0.9" it's works fine

That error appears probably because the package.json version which is set by electron.net needs to be in semantic version format. You can find more about semantic versioning at semver and npmjs

@BenjaminVettori commented on GitHub (Sep 5, 2022): > I need to add build version like "1.0.0.9" but shows 'Invalid version: "1.0.0.9" failedTask=build stackTrace=Error: Invalid version: "1.0.0.9"' But when i try "1.0.9" it's works fine That error appears probably because the package.json version which is set by electron.net needs to be in semantic version format. You can find more about semantic versioning at [semver](https://semver.org) and [npmjs](https://docs.npmjs.com/about-semantic-versioning)
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#636