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

App dependency not being packaged in app.asar (node_modules folder empty) #801

Closed
lbssousa opened this issue Oct 7, 2016 · 3 comments
Closed

Comments

@lbssousa
Copy link

lbssousa commented Oct 7, 2016

  • Version: 7.11.2
  • Target: Windows (7z, nsis), Linux (AppImage, deb)

I'm trying to package an app which has runtime dependency on electron-localshortcut. I've declared "electron-localshortcut": "^0.6.1" in both "devDependencies" (at development package.json file) and "dependencies" (at application package.json file).

However, when I try to launch the app, it gives me an error message telling that electron-localshortcut module was not found. Investigating the contents of dist/*-unpacked/resources/app.asar, it seems that folder node_modules remains empty after building.

@develar
Copy link
Member

develar commented Oct 10, 2016

Could you please provide sample project? Are you sure that electron-localshortcut is not in the devDependencies of app package.json? And installed (electron-builder doesn't install dependencies).

@lbssousa
Copy link
Author

Let me describe better my current setup:

  • I have only "dependencies"in my application package.json file.
  • I'm building my app in a clean environment (Docker comtainer). My current docker-compose.yml has the following contents:
app:
  build: .
  command: sh -c "rm -rf dist*; npm cache clear; npm install; npm update; npm prune; npm run dist"
  volumes:
    - ~/.electron:/root/.electron:Z
    - .:/project:Z
    - app-node-modules:/project/node_modules:Z
  • My development package.json contains the following scripts:
"scripts": {
    "start": "npm install && electron ./app",
    "pack": "build --dir",
    "dist": "npm install && build -wl --x64 --ia32",
    "dist:linux": "npm install && build -l --x64 --ia32",
    "dist:win": "npm install && build -w --x64 --ia32",
    "release": "build"
  }

Should I have to run cd ./app && npm install somewhere in my scripts?

@develar
Copy link
Member

develar commented Nov 29, 2016

10.2.0 should be ok. Also, please consider to migrate to simple one-package.json structure. electron-builder 9 doesn't force you to use 2-package.json structure even if you have native deps.

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

No branches or pull requests

2 participants