Skip to content

electrify:meteor:index@client: cannot initialize connection. Did you npm install -g electrify? #74

Description

@juceling

hi.
At first. thank you for good package. this is very useful.

I`m newbie developer.. and not good talking with english... sorry.

I`m developing some meteor web app and I want to export client side code to desktop app with electron.
so, I tried with your good package, electrify.
build was completed successfully.

but, I tried to test with electrify.methods, electron app show me below error message.

I pacakged my app with electrify command

electrify package --settings settings-electron-electrify-dev.json --output=$APP_PATH -- --icon=$ICON_PATH --app-version=$VERSION

when I run server, this log is shown.
I think this logs are occurred when socket is opened, isn`t it?
if so, is this electron app(client side) problem?

GET /electrify/info 3ms 200
GET /electrify/594/n5pxxchf/websocket 2ms (unfinished)
electrify:meteor:index@server: connection is open

Here is my index.js code

app.on('ready', function() {
  // electrify start
  electrify.start(function(meteor_root_url) {
    // creates a new electron window
    window = new browser({
      width: 1200, height: 900,
      'node-integration': false,                    // node integration must to be off
      webPreferences: {
        'allowDisplayingInsecureContent': true,     // to show insecure contents
        'allowRunningInsecureContent': true
      },
    });

    // open up meteor root url
    window.focus();
    window.loadURL(meteor_root_url);

    // open development tools
    window.webContents.openDevTools();

    // open web page smoothly
    window.once('ready-to-show', function(){
      window.show();
    });
  });
});

electrify.methods({
  'hello.world': function(firstname, lastname, done) {
    //do something
    done(null, "Hello " + firstname + ' ' + lastname + "!");
  }
});

and here is my electrify.method call

// coffeescript code
// isElectron() is just my method. check electron chromuim env
if Meteor.isClient
  if isElectron()
    console.log "this is Electron?", isElectron()
    Electrify.call 'hello.world', ['test1', 'test2'], (err, msg) ->
      console.log "err?", err
      console.log "msg?", msg

and I installed electrify

xxxx@xxxx$ npm list --depth=0 -g
/usr/local/lib
├── asar@0.12.4
├── async@1.5.2
├── coffee-script@1.10.0
├── electrify@2.1.4
├── electron-packager@8.4.0
├── electron-prebuilt@0.36.10
├── express@4.13.4
├── jade@1.11.0
├── meteor-down@2.6.0
├── mongodb@2.1.7
├── n@2.1.4
├── npm@2.15.8
├── npm-check@5.4.0
└── stylus@0.54.0

and I installed arboleya:electrify

meteor add arboleya:electrify

and then, when I run the electron app, got this error message
// error when run electron app

electrify:meteor:index@client: cannot initialize connection. Did you `npm install -g electrify`?
install it and try running your meteor app with `electrify` npm command

// error when I call Electrify.call('hello.world', ....)

err? Error: Cannot call methods, socket connection not initialized at (...)
msg? undefined

my develop env

os: Ubuntu 14.04 LTS
npm v2.15.8
node v4.4.7
meteor v1.4.2.3

I don`t know why this is occured...
I think i installed all need packages and I write right source code...

and already I read #21

plz anybody tell me why this is happening..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions