2
electron-packager .
未在Darwin平臺上安裝來自node_modules
的所有模塊。電子包裝商未安裝來自node_modules的所有模塊
當試圖啓動這樣的打包應用程序,會出現以下錯誤:
Uncaught Exception:
Error: Cannot find module 'sudo-prompt'
at Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename
兩個package.json
和node_modules
是當前文件夾中。
我試圖完全刪除node_modules
並用npm install -production
刷新它們,但它無法正確打包應用程序。
的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"
}
與electron-packager
打包應用程序只有chart.js
所有其他依賴失蹤。
.app/Contents/Resources/app $ npm ls
└─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ └── [email protected]
└── [email protected]