Electron-builder: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"

Created on 11 Apr 2018  路  2Comments  路  Source: electron-userland/electron-builder

Electron : 1.8.1
electron-builder: ^19.55.2
electron-updater : ^2.21.4

  • Target:
    windows, mac, Linux
  • Issue:
    I was using electron builder version 19.55.2 and i was getting the error GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN".
    Actually, I have set GitHub token in electron-builder.yml, and it worked for my other project. But this time I am getting

GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"

I even tried setting env variable in main.js file but that also didnt work

process.env.GITHUB_TOKEN = "<mytoken>";

Below is my package.json

{
  "name": "appname",
  "productName": "description",
  "version": "1.0.0",
  "description": "",
  "main": "./main.js",
  "scripts": {
    "postinstall": "install-app-deps",
    "start": "electron .",
    "pack": "build --dir",
    "dist": "build -mwl --x64 --ia32",
    "ship": "build -mwl -p always"
  },
  "author": "amit, <[email protected]>",
  "email": "[email protected]",
  "repository": "<mygitrepo>",
  "license": "ISC",
  "dependencies": {
    "electron-dl": "^1.11.0",
    "electron-updater": "^2.21.4",
    "ffmpeg-static": "^2.1.0",
    "jquery": "^2.1.4",
    "js-cookie": "^2.2.0",
    "menu": "^0.2.5",
    "moment": "^2.20.1",
    "request": "^2.83.0",
    "secure-ls": "^1.1.0",
    "shelljs": "^0.8.1",
    "store": "^2.0.12",
    "stream-to-blob": "^1.0.0"
  },
  "devDependencies": {
    "electron": "^1.8.1",
    "electron-builder": "^19.55.2"
  },
  "build": {
    "appId": "appname",
    "compression": "maximum",
    "asar": false,
    "mac" : {
      "category" : "public.app-category.education"
    },
    "dmg": {
      "contents": [
        {
          "x": 110,
          "y": 150
        },
        {
          "x": 240,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "linux": {
      "target": [
        "AppImage",
        "deb"
      ]
    },
    "win": {
      "target": "NSIS",
      "icon": "build/icon.ico"
    }
  }
}

Most helpful comment

I think you shouldn't pass this token inside files, you can try passing it in your build command, for example:

$ GH_TOKEN=xxxxxx yarn build

All 2 comments

I think you shouldn't pass this token inside files, you can try passing it in your build command, for example:

$ GH_TOKEN=xxxxxx yarn build

Well, I fixed it by adding it to .bash_profile. But your idea is much easier and handy.

Was this page helpful?
0 / 5 - 0 ratings