Error: Cannot find module ... app.asar/index.js
See original GitHub issueSuccessfully built my angular1 app as an electron app. I can run it using electron-prebuilt, however, when I launch the installed dmg, the app fails immediately.
Image contains error message:
my dev-level package.json:
{
"name": "activity-frontend",
"version": "1.1.1",
"author": "Sante Kotturi",
"description": "activity-frontend: An Ionic project",
"dependencies": {
"gulp": "^3.5.6",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^2.0.4"
},
"devDependencies": {
"bower": "^1.3.3",
"electron-builder": "^3.5.0",
"electron-prebuilt": "^0.37.5",
"gulp-util": "^2.2.14",
"shelljs": "^0.3.0"
},
"scripts": {
"electron": "electron www",
"postinstall": "install-app-deps",
"pack": "build",
"dist": "build"
},
"build": {
"osx": {
"contents": [
{
"x": 410,
"y": 220,
"type": "link",
"path": "/Applications"
},
{
"x": 130,
"y": 220,
"type": "file"
}
]
}
}
}
my app-level package.json which specifies a main.js:
{
"name" : "activity-uploader",
"version" : "0.0.1",
"main" : "main.js"
}
my main.js just in case it helps: [EDIT with correct main.js]
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
// Report crashes to our server.
require('crash-reporter').start();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is GCed.
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform != 'darwin') {
app.quit();
}
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({width: 800, height: 700});
// and load the index.html of the app.
mainWindow.loadURL('file://' + __dirname + '/index.html');
// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
I launched Mac Finder > my app > Contents > Resources
to see if app.asar was an inspectable but its a binary file:
app.asar: application/octet-stream; charset=binary
Any help or pointing in the right directions of resources is much appreciated.
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (11 by maintainers)
Top Results From Across the Web
(No title)
Error : Cannot find module '/opt/Ferdi/resources/app.asar/node_modules/@meetfranz/theme/lib/index.js' · Ask Question. Asked 1 year, 5 ...
Read more >Error: cannot find module [Node npm Error Solved]
I'll do that by running yarn add react-icons . Once I install the package and run the app, everything should successfully compile: ss2....
Read more >Built app doesn't start - Development
Uncaught Error : Cannot find module '../lib/eventManager' Require stack: - /Applications/Joplin.app/Contents/Resources/app.asar/app.js ...
Read more >Sqlite3 bug on Manjaro ARM #926
... --save Error: Cannot find module '/usr/lib/ferdi/app.asar/node_modules/sqlite3/ ... _resolveFilename (electron/js2c/browser_init.js:281:679) at Module.
Read more >Error: Cannot find module '/opt/render/project/src/app.js'
Why is it showing this Error: Cannot find module '/opt/render/project/src/app.js'. ? My package.json file is: { “version”: “1.0.0”, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Try to set path as
"main" : "./main.js"
I was having the
"index.js" in the "app.asar" does not exist. Seems like a wrong configuration.
error because my electron app is not in anapp
folder. So I added this to thepackage.json
of the main repo (not the one of the app).Hope it helps someone.