question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Confused by 2 package.json structure

See original GitHub issue
  • Version: 5.12.1
  • Target: win32

I guess I’m confused by the two-package.json structure.

I am use to installing things with npm, which means everything is specified in /package.json (what you call the development package.json). But electron-builder gives me errors or deprecation messages for having fields like “homepage” and “license” in my /package.json. However, /app/package.json (what you call the application package.json) is not allowed to have “build” and other fields, so neither file feels “complete”.

  1. I definitely have to put my app’s dependencies in /app/package.json, but do I need to put them in /package.json too? Or is /package.json just used for build tool dependencies?
  2. Which would you put on npm?

If I make /package.json the npm module, then the dependencies listed would be build dependencies rather than app dependencies, and electron-builder is going to fuss about homepage and license fields. But if I make /app/package.json the npm module, then it will not install the build dependencies, and the npm module will be a folder inside my github repo rather than the github repo.

  1. Why can’t you just have an “electronDependencies” section in /package.json, and then derive /app/package.json during the build?

Having two keep two separate package.json’s in sync (particularly the “version” field, but also “description”, “homepage” etc) is just inviting me to screw up. I’d much prefer a single source of truth.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
develarcommented, Oct 11, 2016

@akashnimare Please file new issue and describe why it doesn’t work for you.

can you point me to an example app which uses single packge.json?

https://github.com/electron-userland/electron-builder/tree/master/test/fixtures/test-app-one

2reactions
wmhiltoncommented, Oct 14, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Two package.json Structure - electron-builder
For development ( ./package.json ). The package.json resides in the root of your project. Here you declare the dependencies for your development environment ......
Read more >
The Symbols In Your package.json File - Moving Forward
I have often been confused by the symbols in the package.json file. If you are new to node.js, and you create a new...
Read more >
Anatomy of a Package - SurviveJS
json#. All packages come with a package.json file that contains package metadata, like information about the author, link to a bug tracker and...
Read more >
Package.json Explained - Let's React
Confused, just the braces as package.json file? ... The only requirement is that it should respect the JSON format.
Read more >
But what the hell is package-lock.json?
2. Package.json. package.json is a file that contains information about your project ... See this S.O. post for an example of the confusion...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found