Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'build' is not recognized as an internal or external command - Using ElectronJS / electron-builder

I recently updated my electronJS app to a higher version together with electron-builder. I have no issues running the app with "npm start", however when I try to build it using electron-builder I get the following error when running "npm run dist":

$ npm run dist

[email protected] dist C:\Projects\myapp build

'build' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dist: build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dist script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\User\AppData\Roaming\npm-cache_logs\2019-12-05T11_35_33_988Z-debug.log

package.json:

{
  "name": "myapp",
  "version": "1.1.0",
  "description": "none",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "dist": "build",
    "postinstall": "electron-builder install-app-deps"
  },
  "build": {
    "appId": "Myapp.com",
    "asar": true,
    "asarUnpack": [
      "configuration/**/*",
      "output/**/*",
      "appdata/**/*",
      "node_modules/easy-pdf-merge/**/*"
    ]
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "author": "",
  "license": "ISC",
  "homepage": "",
  "dependencies": {
    "axios": "^0.19.0",
    "cryptr": "^6.0.1",
    "easy-pdf-merge": "^0.2.0",
    "edit-json-file": "^1.2.0",
    "electron-log": "^3.0.9",
    "electron-updater": "^4.2.0",
    "eslint": "^5.12.0",
    "exceljs": "^1.6.3",
    "googleapis": "^27.0.0",
    "mustache": "^3.0.1",
    "node-localstorage": "^2.1.5",
    "npm": "^6.5.0",
    "pdf-table-extractor": "^1.0.3",
    "popper.js": "^1.15.0",
    "sqlite3": "^4.0.4",
    "tippy.js": "^4.3.4",
    "universal-analytics": "^0.4.20",
    "uuid": "^3.3.3",
    "webpack": "^4.28.0",
    "winston": "^3.1.0"
  },
  "devDependencies": {
    "electron": "^7.1.3",
    "electron-builder": "^21.2.0"
  }
}

Node version: 12.13.1 npm version: 6.12.1

like image 532
user1725266 Avatar asked Jan 26 '23 13:01

user1725266


1 Answers

After updating I had missed the following in package.json:

"scripts": {
  "pack": "electron-builder --dir",
  "dist": "electron-builder"
}

according to this: https://www.npmjs.com/package/electron-builder

like image 147
user1725266 Avatar answered Jan 30 '23 08:01

user1725266