4

ここhttps://github.com/appjs/appjs/tree/master/examplesにあるappjsを使用して、サンプル プロジェクトの 1 つを実行しようとしています。Windows(64ビットマシン)で最新バージョンのnode.js(v4.1.0)を使用しています

コマンドプロンプトで以下のコマンドを使用して例を実行しようとすると

node --harmony index.js

次のようなエラーが表示されます。

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)

この問題を検索しようとしましたが、解決策が見つかりませんでした。ハーモニーフラグでnode.jsを使用する方法を誰か教えてもらえますか?

UPDATE 私のindex.jsは次のようになります

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()));
});
}

Node.jsのv0.12で、以下のエラーが発生します

    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 に答える 1