Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not include other node_modules packages in compiling #1311

Open
3 tasks done
I2rys opened this issue Dec 6, 2021 · 2 comments
Open
3 tasks done

Does not include other node_modules packages in compiling #1311

I2rys opened this issue Dec 6, 2021 · 2 comments
Labels

Comments

@I2rys
Copy link

I2rys commented Dec 6, 2021

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Issue Details

  • Electron Packager Version:
    *15.4.0
  • Electron Version:
    *16.0.4
  • Operating System:
    • Microsoft Windows 10 Pro
  • Last Known Working Electron Packager version::
    • None

Expected Behavior

It should be able to include node_modules packages in compiling Including express, discordnitro & other NPM packages.

Actual Behavior

After the compiling, run the compiled EXE file and It should return an error Cannot find module 'discordnitro'

To Reproduce

  1. Open CMD and type this command create-electron-app reproduce, Just an example.
  2. cd to the directory & install discordnitro. npm i discordnitro
  3. Import the discordnitro in the file.
  4. cd to src and build it. cd src && electron-packager ./ reproduce --platform=win32 --arch=x64
  5. Run the compiled EXE file and It should return an error Cannot find module 'discordnitro'.

Additional Information

None

@I2rys I2rys added the bug 🐛 label Dec 6, 2021
@welcome
Copy link

welcome bot commented Dec 6, 2021

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@jtkDvlp
Copy link

jtkDvlp commented Feb 2, 2022

Hi @I2rys,

I got the same or similar problem. After research I found this change #819 since then you have to take care of the pruned node_modules by yourself.

See also the readme "usage"

...Be careful not to include node_modules you don't want into your final app. If you put them in the devDependencies section of package.json, by default none of the modules related to those dependencies will be copied in the app bundles. (This behavior can be turned off with the prune: false API option or --no-prune CLI flag.) In addition, folders like .git and node_modules/.bin will be ignored by default. You can use --ignore to ignore files and folders via a regular expression (not a glob pattern). Examples include --ignore=.gitignore or --ignore=".git(ignore|modules)"...

an prune:false worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants