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.

Nested node_modules disappears after building

See original GitHub issue
  • Version: 20.26.0
  • Target: macOS (.dmg)

Similar to https://github.com/electron-userland/electron-builder/issues/1539, I’m working with an app where I’ve cloned another git repo int and I have several node_modules folders. When I build, the node_modules folder in the nested git repo disappears. This happens whether asar is enabled or disabled. It also happens regardless of whether or not the inner git repo is officially designated as a git submodule or if I’ve just manually cloned it in.

Here’s my folder structure:

main.js (starts app and forks process from the express app's index.js)
node_modules
package.json
cloned-express-app
   |
    --node_modules
      index.js
      package.json

Here’s a Stack Overflow issue I just created that may explain it better (I didn’t want to copy/paste but let me know if that’s preferred) and here’s the repo I’m working with.

It’s also worth noting that I’ve tried building this for Windows and my friend said it works fine on there. I haven’t tested that recently though so I can’t give much info on that immediately. I also haven’t inspected the Resources contents of the packaged app (or whatever the .exe counterpart would be) so I can’t provide info on that but I do know that when I look in the mac app’s Resources directory there is no node_modules folder within the nested git repo.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:55 (11 by maintainers)

github_iconTop GitHub Comments

12reactions
bedneycommented, Jun 2, 2021

A new version of this patch has been pushed and I’m actively working with the project maintainers to resolve any outstanding issues.

8reactions
TanninOnecommented, May 2, 2019

Am I missing something here? How is this bug still not addressed? Afaict all releases post 20.15.0 are unusable and should be considered extremely dangerous, how is this not top priority? @develar ? I don’t want to be annoying, but I’ve not been able to produce a working build with any electron-builder after 20.15.0 and I’m starting to panic as you don’t even seem to acknowledge there is a problem here. And no, hn3000s explanation does not fully explain the problem, I get this error even entirely without any files excludes.

My project depends on semver@^5.6.0 A dependency I include (semvish) depends on semver@^4.6.3 electron-builder packages semver@^4.6.3 twice, in semvish/node_modules and the top-level node_modules, causing bugs in my main application, breaking electron-updater among other things. And I’ll just assume this is one problem of many caused by this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nested node_modules folder disappears after packaging
This is caused by a bug in electron-builder that is present after version 20.15.0 and at least up to version 20.26.0.
Read more >
The node_modules problem - DEV Community ‍ ‍
As I've said, the problem when copying node_modules folder from one place to another is not the size, it is the amount of...
Read more >
Advanced package manager features for npm, Yarn, and pnpm
pnpm stores dependencies in a nested node_modules folder, like npm, but provides better performance and disk-space efficiency because of its ...
Read more >
Recover missing package.json with npm-collect
I did some digging and came across the Node package npm-collect that provides ways to create a new package.json from node_modules folders. All ......
Read more >
Module Federation - webpack
Local overrides (via __webpack_override__ or override API when build is also ... and consume multiple different versions when you have nested node_modules.
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