Reputation: 1399
electron-packager .
not installing all modules from node_modules
on Darwin platform.
When trying to start such packaged app, following error occurs:
Uncaught Exception:
Error: Cannot find module 'sudo-prompt'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename
Both package.json
and node_modules
are in current folder.
I’ve tried to remove node_modules
completely and refresh them with npm install -production
but it didn't help to package the app correctly.
package.json
"main": "app.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"chokidar": "^1.7.0",
"electron": "^1.6.11",
"filesize": "^3.5.6",
"jquery": "^3.2.1",
"keymaster": "^1.6.2",
"open": "0.0.5",
"peity": "^3.2.1",
"sudo-prompt": "^7.1.0",
"underscore": "^1.8.3",
"unzip-stream": "^0.1.2"
},
"dependencies": {
"chart.js": "^2.6.0",
"filesize": "^3.5.10",
"open": "0.0.5",
"sudo-prompt": "^7.1.0"
}
Packaged app with electron-packager
has only chart.js
All other dependencies are missing.
.app/Contents/Resources/app $ npm ls
└─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
└── [email protected]
Upvotes: 3
Views: 2253
Reputation: 1399
Just in case someone faces similar problem:
Removing duplicated dependencies
modules from devDependencies
solved the issue.
Upvotes: 4