• electron-builder version=20.19.2
• loaded configuration file=package.json ("build" field)
SyntaxError: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at then.it (C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:55:22)
at tryCatcher (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\promise.js:693:18)
at Promise._fulfill (C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\promise.js:638:18)
at C:\Users\sandi\Projects\rs-manager\node_modules\bluebird\js\release\nodeback.js:42:21
at C:\Users\sandi\Projects\rs-manager\node_modules\graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
From previous event:
at readJson (C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:55:6)
at C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:224:61
at Generator.next (<anonymous>)
at C:\Users\sandi\Projects\rs-manager\node_modules\graceful-fs\polyfills.js:287:18
at FSReqWrap.oncomplete (fs.js:159:5)
From previous event:
at Collector.readChildPackage (C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:206:90)
at _bluebirdLst.default.map.it (C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:191:69)
From previous event:
at C:\Users\sandi\Projects\rs-manager\node_modules\electron-builder-lib\src\util\packageDependencies.ts:191:40
at Generator.next (<anonymous>)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `install-app-deps`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
My build section looks like
"build": {
"appId": "com.sandi.rsmanager",
"win": {
"target": "NSIS"
}
},
It's similar to #2660 but i am on version 20.19.2
the same json works perfectly when i am building for mac though
Version 20.28.1
I get #2660 error in random time for same builds.
For example: I build project with webpack & electron-updater. Build it 7 times. And I get this error 4 times. How I can solve it?
PS: I . don't change code for before each build.
I am experiencing a similar problem. I get
SyntaxError: Unexpected token < in JSON at position 1121
at JSON.parse (<anonymous>) when running electron-builder.
It appears that <anonymous> is somehow getting pased in pretty early. The bottom of the entire callstack shows at then (<project path here>/node_modules/electron-builder/src/cli/cli.ts:46:19)
same error here but with Mac! if my dependencies contains "@angular/pwa": "^0.12.3", (or other versions) i got error SyntaxError: Unexpected token < in JSON at position 1121 at JSON.parse
Its related to the @schematics/angular verison required within @angular/pwa.
On older versions of schematics some template files where suffixed with .json which made electron-builder trying to parse them and treat them like valid JSON.
While actually it was not valid JSON. Since @schematics/angular >= 7.3.0 they suffixed these files with .template and the error is gone.
See https://github.com/angular/angular-cli/commit/36eba0c9fcf17305a7ef99096c860ad271c5aaf7#diff-84ab480b30e45c756807451b0b4411e1
Most helpful comment
I am experiencing a similar problem. I get
SyntaxError: Unexpected token < in JSON at position 1121 at JSON.parse (<anonymous>)when running electron-builder.It appears that
<anonymous>is somehow getting pased in pretty early. The bottom of the entire callstack showsat then (<project path here>/node_modules/electron-builder/src/cli/cli.ts:46:19)