简体   繁体   中英

how to set package.json for first build electron

"devDependencies": {
"asar": "^0.14.6",
"electron": "^4.0.5",
"electron-packager": "^13.0.1"
}

I want to build electron app. So I'd like to know if the package should be included in the DepDefendencies section as above. What did I miss?

The easiest is to let npm do this for you .

create a folder for your project then go into that folder and run, follow the prompts:

npm init

Npm will create a package.json for you. Then to set up electron run follow their website :

npm i -D electron@latest

Which produces something like this:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^4.0.5"
  }
}

Then you can add other tools like the electon-packager :

npm install electron-packager --save-dev

The --save-dev are tools used for your development, and will be stored in the devDependencies, any libraries that you need to run your application are saved in dependencies and use the --save switch.

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