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

No such module: atom_common_app #8423

Closed
petrbrzek opened this issue Jan 17, 2017 · 18 comments
Closed

No such module: atom_common_app #8423

petrbrzek opened this issue Jan 17, 2017 · 18 comments
Assignees
Labels

Comments

@petrbrzek
Copy link

No such module: atom_common_app
  • Electron version: 1.4.12
  • Operating system: Mac OS X, Windows 7/10, Linux

How to reproduce

Dunno. We started to see the issue in our Sentry 5 days ago.

@kevinsawicki
Copy link
Contributor

Can you provide more of the stack trace for this error?

@kevinsawicki kevinsawicki added the blocked/need-info ❌ Cannot proceed without more information label Jan 17, 2017
@petrbrzek
Copy link
Author

Here it is. @kevinsawicki

Error: No such module: atom_common_app
    at Error (native)
    at process.atomBinding (/Applications/Avocode.app/Contents/Resources/electron.asar/common/init.js:10:14)
    at Object.<anonymous> (/Applications/Avocode.app/Contents/Resources/electron.asar/browser/api/app.js:3:26)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.get (/Applications/Avocode.app/Contents/Resources/electron.asar/browser/api/exports/electron.js:11:14)
    at stringify (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/node_modules/json-stringify-safe/stringify.js:5:15)
    at Object._makeRequest (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:1495:22)
    at Object._sendProcessedPayload (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:1431:56)
    at Object._send (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:1388:14)
    at Object._processException (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:1285:14)
    at Object._handleStackInfo (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:1191:14)
    at Object.captureException (/Applications/Avocode.app/Contents/Resources/app.asar/node_modules/raven-js/src/raven.js:345:18)
    at e.captureException (file:///Applications/Avocode.app/Contents/Resources/app.asar/dist/avocode.min.js:30:28213)
    at file:///Applications/Avocode.app/Contents/Resources/app.asar/dist/avocode.min.js:41:4134

@kevinsawicki
Copy link
Contributor

@petrbrzek is dist/avocode.min.js running in the browser process or main process?

@petrbrzek
Copy link
Author

@kevinsawicki In the renderer process.

@joeyhage
Copy link

I'm having this same issue. Was anyone able to resolve this? Thank you in advance!

@kevinsawicki
Copy link
Contributor

@ImaPepper are you able to reproduce this consistently and could you provide some reproduction steps if you are?

@kevinsawicki
Copy link
Contributor

@petrbrzek are you ever passing the require('electron') object over IPC?

@joeyhage
Copy link

joeyhage commented Feb 23, 2017

@kevinsawicki Yes, it happens every time one of my js files is loaded from an html view. I also get three deprecated warnings each time.

'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead.

remote.js:68 'webkitIndexedDB' is deprecated. Please use 'indexedDB' instead.

remote.js:68 'Performance.onwebkitresourcetimingbufferfull' is deprecated. Please use 'Performance.onresourcetimingbufferfull' instead.

init.js:10 Uncaught Error: No such module: atom_common_app
    process.atomBinding @ init.js:10
    (anonymous function) @ app.js:3
    Module._compile @ module.js:556
    Module._extensions..js @ module.js:565
    Module.load @ module.js:473
    tryModuleLoad @ module.js:432
    Module._load @ module.js:424
    Module.require @ module.js:483
    require @ internal/module.js:20
    get @ electron.js:11
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    wrapArgs @ remote.js:91
    valueToMeta @ remote.js:30
    valueToMeta @ remote.js:68
    wrapArgs @ remote.js:91
    valueToMeta @ remote.js:30
    valueToMeta @ remote.js:68
    wrapArgs @ remote.js:91
    valueToMeta @ remote.js:30
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    valueToMeta @ remote.js:68
    wrapArgs @ remote.js:91
    remoteMemberFunction @ remote.js:112
    populateReportTable @ attendanceReport.js:6
    (anonymous function) @ attendanceReport.js:2

@kevinsawicki
Copy link
Contributor

@ImaPepper can you include the line of code at populateReportTable @ attendanceReport.js:6 or the entire file if possible?

@joeyhage
Copy link

joeyhage commented Feb 23, 2017

@kevinsawicki I have a main.js which is also loaded by all of my views, and requires the appropriate node modules and files. So app is defined there. If I try to require it in this file as well, I get an error that it is already defined. I have other views and javascript files that it works perfectly for so I don't think the lack of the require statement in this file is the issue.

let buildReportBtn = document.getElementById('build-report');
buildReportBtn.addEventListener('click', populateReportTable());

function populateReportTable() {
    let eventId = document.getElementById('event-id');
    app.buildAttendanceReport(eventId, (error, results) => { //LINE 6
        $('tbody>tr').remove();
        let table = document.querySelector('#report>tbody');
        for (let i = 0; i < results.length; i++) {
            let row = document.createElement('tr');
            let netId = document.createElement('td');
            netId.appendChild(document.createTextNode(message[i].netid));
            let name = document.createElement('td');
            name.appendChild(document.createTextNode(message[i].last_name + ', ' + message[i].first_name));
            let classification = document.createElement('td');
            classification.appendChild(document.createTextNode(message[i].classification));
            let major = document.createElement('td');
            major.appendChild(document.createTextNode(message[i].major));
            row.appendChild(netId);
            row.appendChild(name);
            row.appendChild(classification);
            row.appendChild(major);
            table.appendChild(row);
        }
    })
}

@kevinsawicki
Copy link
Contributor

kevinsawicki commented Feb 23, 2017

@ImaPepper what is app? How is it declared? Is buildAttendanceReport a remote function?

@joeyhage
Copy link

@kevinsawicki I updated my comment above

@joeyhage
Copy link

joeyhage commented Feb 23, 2017

@kevinsawicki main.js; mainly used for a navigation pane that is standard across all views.

const remote = require('electron').remote;
const app = remote.require('./app.js');
const ipcRenderer = require('electron').ipcRenderer;
const $ = require('jQuery');

let index = document.getElementById('index');
index.addEventListener('click', () => {
    app.indexPage()
});

let eventCheckIn = document.getElementById('event-check-in');
eventCheckIn.addEventListener('click', () => {
    app.checkInPage()
});

let attendanceReport = document.getElementById('attendance-report');
attendanceReport.addEventListener('click', () => {
    app.attendanceReportPage()
});

let help = document.getElementById('help');
help.addEventListener('click', () => {
    app.helpPage()
});

Appropriate functions inside app.js

function buildAttendanceReport(eventId, callback) {
    connection.query('SELECT `is_members`.`netid`, `is_members`.`last_name`, `is_members`.`first_name`, ' +
        '`is_members`.`classification`, `is_members`.`major` FROM `is_members` INNER JOIN `is_attendance` ON ' +
        '`is_members`.`netid`=`is_attendance`.`netid` WHERE `is_attendance`.`event_id`=?', [eventId],
        (error, results, fields) => {
        if(error) {
            console.error(error);
            callback(error);
        }
        callback(null, results);
    })
}

exports.buildAttendanceReport = (eventId, callback) => {
    buildAttendanceReport(eventId, (error, results) => {
        if(error) {
            console.error(error);
            callback(error);
        }
        callback(null, results);
    })
};

@kevinsawicki
Copy link
Contributor

@ImaPepper does the #event-id element have any data attributes or other custom properties set on it?

@joeyhage
Copy link

joeyhage commented Feb 23, 2017

@kevinsawicki Ahhh I fixed it! Silly mistake on my part. Thank you so much for your help! It should have been:

function populateReportTable() {
    let eventId = document.getElementById('event-id');
    app.buildAttendanceReport(eventId.value, (error, results) => { //LINE 6
        $('tbody>tr').remove();
        let table = document.querySelector('#report>tbody');
        for (let i = 0; i < results.length; i++) {
            let row = document.createElement('tr');
            let netId = document.createElement('td');
            netId.appendChild(document.createTextNode(message[i].netid));
            let name = document.createElement('td');
            name.appendChild(document.createTextNode(message[i].last_name + ', ' + message[i].first_name));
            let classification = document.createElement('td');
            classification.appendChild(document.createTextNode(message[i].classification));
            let major = document.createElement('td');
            major.appendChild(document.createTextNode(message[i].major));
            row.appendChild(netId);
            row.appendChild(name);
            row.appendChild(classification);
            row.appendChild(major);
            table.appendChild(row);
        }
    })
}

@kevinsawicki
Copy link
Contributor

It should have been:

So are you still seeing the error when using eventId.value or did it go away once you changed it?

@joeyhage
Copy link

All errors went away. Apparently, by inadvertently trying to send an HTML element rather than a text value into the function, it caused all those errors.

@kevinsawicki
Copy link
Contributor

I was able to reproduce this, looks like it can happen whenever you pass an object that references the module cache.

Such as:

require('electron').remote.app.getPath(global.module)

This is because this line:

const browserModules = require('../../browser/api/exports/electron')
puts the main process exports in the module cache which then causes issues when it is attempted to be serialized over the remote API.

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

4 participants