Failed to start appjs sample application using node.js

I am trying to run one of the sample projects using appjs , which is present here https://github.com/appjs/appjs/tree/master/examples . I am using the latest version of node.js (v4.1.0) on Windows (64-bit machine)

When I try to run this example using the command below on the command line

node --harmony index.js

I get the error as follows:

Error: AppJS requires Node is run with the --harmony command line flag
at Object.<anonymous> (F:\programs\appjs_examples\node_modules\appjs\lib\ind
ex.js:2:9)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (F:\programs\appjs_examples\octosocial\index.js:1:73)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)

I tried to find this problem, but could not find a solution. Can someone tell me how to use node.js with a harmony flag?

UPDATE   My index.js is as follows

var app = require('appjs'),
github = new (require('github'))({ version: '3.0.0' }),
KEY_F12 = process.platform === 'darwin' ? 63247 : 123;

app.serveFilesFrom(__dirname + '/assets');

var window = app.createWindow({
 width: 460,
  height: 640,
 resizable: false,
  disableSecurity: true,
  icons: __dirname + '/assets/icons'
 });

  window.on('create', function(){
   window.frame.show();
   window.frame.center();
   });

 window.on('ready', function(){
   var $ = window.$,
  $username = $('input[name=username]'),
  $password = $('input[name=password]'),
  $info = $('#info-login'),
  $label = $info.find('span'),
  $buttons = $('input, button');

 $(window).on('keydown', function(e){
  if (e.keyCode === KEY_F12) {
    window.frame.openDevTools();
  }
});

 $username.focus();

 $('#login-form').submit(function(e){
e.preventDefault();

$info.removeClass('error').addClass('success');
$label.text('Logging in...');
$buttons.attr('disabled', true);

  github.authenticate({
    type: 'basic',
   username: $username.val(),
  password: $password.val()
   });

github.user.get({}, function(err, result) {
  if (err) {
    $info.removeClass('success').addClass('error');
    $label.text('Login Failed. Try Again.');
    $buttons.removeAttr('disabled');
  } else {
    loggedIn(result);
  }
  });
});

 function loggedIn(result){
    $label.text('Logged in!');
    $('#user-avatar').append('<img src="'+result.avatar_url+'" width="64" height="64">');
   $('#user-name').text(result.name);
    $('#login-section').hide();
    $('#profile-section').show();
    ['Followers', 'Following'].forEach(function(type){
      github.user['get'+type]({ user: result.login }, populate.bind(null,     type.toLowerCase()));
});
}

Now with v0.12 node.js I get below errors

    F:\softwares\Node.js_v0.12\node_modules\appjs\lib\index.js:2
throw new Error ('AppJS requires Node is run with the --harmony command line
  Error: AppJS requires Node is run with the --harmony command line flag
  at Object.<anonymous> (F:\softwares\Node.js_v0.12\node_modules\appjs\lib\ind
ex.js:2:9)
   at Module._compile (module.js:460:26)
   at Object.Module._extensions..js (module.js:478:10)
   at Module.load (module.js:355:32)
   at Function.Module._load (module.js:310:12)
   at Module.require (module.js:365:17)
   at require (module.js:384:17)
   at Object.<anonymous> (F:\softwares\Node.js_v0.12\index.js:1:73)
   at Module._compile (module.js:460:26)
   at Object.Module._extensions..js (module.js:478:10)
+4
1

node v0.12.7 v4.0.0. , node_modules/appjs/lib/index.js , - , .

--harmony . --harmony_proxies.

, :

  • node , Proxy. " ".

  • node --harmony . .

  • , node --harmony-proxies. Bam, .

v4.x.x, .

node.js io.js v4, ES6, , 4.x.x. https://nodejs.org/en/docs/es6/

https://github.com/appjs/appjs , , 32 ;)

Edit:

:

node --harmony-proxies index.js

, 3 . enter image description here

+2

Source: https://habr.com/ru/post/1607856/


All Articles