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.

root package.json not found when specifying different src directory

See original GitHub issue

Electron Version: 1.6.5 Electron Packager Version : 8.6.0 Node Version: 6.4.0 NPM Version: 3.10.3

I am using electron-packager with webpack. Essentially building my app with webpack to an output folder called dist and then calling electron-packager. I want to be able to call it like: electron-packager dist but it always fails saying there is no package.json. Obviously there is no package.json in the dist folder but there is an package.json in the root of the project one folder up.

If I copy my package.json from the root into the dist folder and try again it works fine but barring that it will fail. Is there anyway to do this without copying the package.json. Ideally I would like electron-packager to take the root package.json and the code in the dist folder and produce a electron package.

Project Structure

|-root
     |-dist
          |-app.js
          |-index.html
     |-node_modules
     |-src
         |-<source code>
     |-webpack.js
     |-package.json

electron-packager . - works (but copies everything in root level) electron-package dist - fails

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
MarshallOfSoundcommented, Apr 23, 2017

The structure you have described can easily be achieved with the current options.

You want to set the “main” value in your package.json file to point at the generated entry point (your DIST folder) then set up the --ignore CLI argument or the ignore option in the API to ignore all files in the original src directory 👍

0reactions
dland512commented, Aug 21, 2017

Got it, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

'package.json' is not under 'rootDir' - Stack Overflow
We'll treat the src directory and the root directory containing package.json as separate projects. Each will have its own tsconfig file.
Read more >
jsconfig.json Reference - Visual Studio Code
json file in a directory indicates that the directory is the root of a JavaScript Project. The jsconfig.json file specifies the root files...
Read more >
Modules: Packages | Node.js v19.3.0 Documentation
A package is a folder tree described by a package.json file. The package consists of the folder containing the package.json file and all...
Read more >
Main entry point does not exist - Cyclic Documentation
ERROR: The main entry point defined in package.json 'index.js' does not exist. ... their entry points in files other than index.js in the...
Read more >
npm-install - npm Docs
If <folder> sits outside the root of your project, npm will not install the package dependencies in the directory <folder> , but it...
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