Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

_.mixin is not a function #472

Closed
lazukars opened this issue Apr 6, 2016 · 34 comments
Closed

_.mixin is not a function #472

lazukars opened this issue Apr 6, 2016 · 34 comments

Comments

@lazukars
Copy link

lazukars commented Apr 6, 2016

Node type: geth
OS: Ubuntu 14.04
Network type: main
Mist version: 0.0.0 ( On master branch. Pulled 04-05-16 )

I've followed the install instructions here, https://github.com/ethereum/mist, to a tee. When I run electron ., the following error occurs. Please see the screenshot.

error__mist

@hiddentao
Copy link
Contributor

I just tried this on the latest master and didn't see this error. I get the GUI showing up and sync begins.

@lazukars
Copy link
Author

Hmm. Just tried pulling master again. I got the same issue. What OS did you try this on?

@hiddentao
Copy link
Contributor

OS X El Capitan 10.11.2

@frozeman
Copy link
Contributor

Can you try the wallet branch? that should have fixed it

@lazukars
Copy link
Author

So it looks like this was an issue with electron. I was running the wrong version.

However, when running npm install -g electron-prebuilt@0.37.2, as instructions state, the error in the attached screenshot occurs.
electron-bug

Note: About a month ago, I had none of these issues, and Mist worked fine.

@hiddentao
Copy link
Contributor

Could you try running npm cache clean and then again doing it? It looks like a possibly corrupted package.json in one of Electron's depenencies.

@hiddentao
Copy link
Contributor

Also, npm uninstall -g electron-prebuilt followed the installation call again.

@lazukars
Copy link
Author

I've done the following:

npm uninstall -g electron-prebuilt
npm cache clean which fixed that last screenshot error.
npm install -g electron-prebuilt@0.37.2
electron -v : output: v0.37.2

cd mist
git pull && git submodule update ( on master branch )
npm install
cd interface && meteor

Now, when running electron . inside the mist dir, I'm getting the initial issue error again, _.mixin is not a function. See initial screenshot. I've tried electron . --mode wallet as well. The same _.mixin is not a function occurs.

@hiddentao
Copy link
Contributor

Could you try it on the develop branch please - that's always the actively developed branch. Just want to rule out branch differences.

@lazukars
Copy link
Author

Sure. Just tried the same commands, from the last comment, on the develop branch. Outcome is the same: _.mixin is not a function when running electron .

@hiddentao
Copy link
Contributor

Ok, can you check within node_modules to see if you have underscore installed. And if you do please tell us what the version number is from its package.json.

@lazukars
Copy link
Author

Sure. In mist/node_modules/underscore/package.json. Looks to be v 1.8.3. See screenshot.
package-json

@hiddentao
Copy link
Contributor

hiddentao commented Apr 19, 2016

Great. Inside node_modules/underscore could you open up underscore.js and search for _.mixin to see if it exists.

If it does then the next step is to open up modules/utils/underscore.js and place the following code after the import at the top:

const _ = module.exports = require('underscore');

// code to insert:
console.log(_.VERSION, Object.keys(_));

Then run the app - this way we can make sure that the version of underscore being loaded at runtime is the same as what's installed. And it will also output what methods are available on the object.

@lazukars
Copy link
Author

No problem. node_modules/underscore/underscore.js is an empty file

@hiddentao
Copy link
Contributor

Ah so looks like underscore didn't install correctly. What I would do is remove your node_modules folder and re-run npm install.

@lazukars
Copy link
Author

Ok. Doing what you suggested worked. When I pull down new code locally, is there some command that should be run so this issue can be avoided in the future? Or just delete the node_modules folder and run npm install after each pull?

There's a new problem now, once the _mixin problem was fixed. When I run electron . the UI loads for about 5 seconds and immediately crashes.

@hiddentao
Copy link
Contributor

For the crash, if you're on the develop branch could you run: electron . --loglevel trace and paste the output in here. Might give us some clues.

As for the module issue, usually you shouldn't have to remove the node_modules folder everytime. It should just work. But if you encounter this again it's worth a try.

@lazukars
Copy link
Author

lazukars commented Apr 19, 2016

Thanks for the tips. Here's the log trace:
trace

I'm on the develop branch. It also crashes on the master branch.

@hiddentao
Copy link
Contributor

Ok, this is hard to debug right now. We will hopefully be capturing UI logs too soon, see #502. In the meantime you could try stopping your existing geth instance and then running electron - it should start up its bundled copy of geth. Maybe that will make a difference.

@hiddentao
Copy link
Contributor

Are you able to start the app in wallet mode?

@hiddentao
Copy link
Contributor

I'm also having trouble starting in mist mode.

@lazukars
Copy link
Author

Wallet mode opens, but it opens to a blank white screen, with the toolbar

on top.

Ryan Lazuka

@frozeman
Copy link
Contributor

It seems something might be wrong with your web3.js you've pulled. Can you install web3@0.15.2 manually from inside your mist folder?

@lazukars
Copy link
Author

lazukars commented Apr 19, 2016

Here's what I have done on the develop branch

cd mist/node_modules
rm -rf web3
cd .. && npm install web3@0.15.2
cd ~/mist/interface
meteor
cd ../ && electron .

Result: Same problem. The UI loads for about 5 seconds then crashes. I've tried stopping my geth instance, like previously suggest,and that does not work either and the results are the same.

@rolandkofler
Copy link

Maybe I'm the only one who didn't know it, but: the error occurs at Line 27 in mistUI.js

window.web3 = new Web3(new Web3.providers.IpcProvider('', ipcProviderWrapper));

More precisely when Web3 is instantiated (not when the IpcProvider is constructed).
I will continue with my research tomorrow afternoon, but if you have any idea would be great to hear it!

@hiddentao
Copy link
Contributor

I don't seem to get an error at the Web3 construction point. Am still investigating.

@hiddentao
Copy link
Contributor

I've narrowed it down to the window creation line:

global.mainWindow = new BrowserWindow({
            title: global.appName,
            show: false,
            width: 1024 + 208,
            height: 720,
            icon: global.icon,
            titleBarStyle: 'hidden-inset', //hidden-inset: more space
            backgroundColor: '#D2D2D2',
            acceptFirstMouse: true,
            darkTheme: true,
            webPreferences: {
                preload: __dirname +'/modules/preloader/mistUI.js',
                nodeIntegration: false,
                'overlay-scrollbars': true,
                webaudio: true,
                webgl: false,
                textAreasAreResizable: true,
                webSecurity: false // necessary to make routing work on file:// protocol
            }
        });

When I comment out the nodeIntegration line I don't get a crash - but I also just get a blank window. When I uncomment the line I start to see the UI contents show, but then the whole thing crashes.

@hiddentao
Copy link
Contributor

So nodeIntegration must be disabled for the Meteor app to work, which means the Meteor app itself might be the cause - but then I'm still getting no errors from within.

@hiddentao
Copy link
Contributor

hiddentao commented May 2, 2016

Narrowed it down. The Mist interface shows a couple of default "tabs". One renders about:blank and the other shows http://ethereum-dapp-wallet.meteor.com. I actually am able to see neither tab but in any case the <webview> tag used to render about:blank doesn't work - and causes the whole app to crash. I suspect this is due to the fact that <webview /> actually launches the URL to be rendered into a new child process, see https://developer.chrome.com/apps/tags/webview

@hiddentao
Copy link
Contributor

At least on my machine the <webview> tag fails to render and thus the Mist dapp content section is empty.

@hiddentao
Copy link
Contributor

@frozeman Here is my proposed fix for this crash issue:

  1. Change about:blank to ethereum.org for default browser tab in Mist.
  2. Add command-line option to reset Mist interface tabs - I had to do this to get the webview working, as otherwise it keeps using what's in localforage. A command-line option is required since an in-app GUI option won't be usable if the app keeps crashing. We could still, however, add an in-app GUI option to reset the interface as this may be something people wish to use more than once.

@hiddentao
Copy link
Contributor

PR in #548

@luclu
Copy link
Contributor

luclu commented Jul 18, 2016

PR merged.

@luclu luclu closed this as completed Jul 18, 2016
@lock
Copy link

lock bot commented Apr 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators Apr 1, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

5 participants