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

Terminal-kit is failing in meteor. #7

Closed
singggum3b opened this issue Jan 4, 2016 · 12 comments
Closed

Terminal-kit is failing in meteor. #7

singggum3b opened this issue Jan 4, 2016 · 12 comments

Comments

@singggum3b
Copy link

var x = Npm.require("terminal-kit");

Error:

undefined

/home/singgum3b/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
                        throw(ex);
                              ^
TypeError: Object prototype may only be an Object or null
    at create (native)
    at Function.create (/home/singgum3b/.meteor/packages/ecmascript-runtime/.0.2.6.s34ngz++os+web.browser+web.cordova/npm/node_modules/meteor-ecmascript-runtime/node_modules/core-js/modules/es6.symbol.js:87:28)
    at Object.<anonymous> (/home/singgum3b/Projects/meteor-gulp-seed/node_modules/terminal-kit/lib/ScreenBuffer.js:42:33)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/singgum3b/Projects/meteor-gulp-seed/node_modules/terminal-kit/lib/termkit.js:58:24)

any idea?

@cronvel
Copy link
Owner

cronvel commented Jan 4, 2016

Hi,

Please give me:

  • the version of terminal-kit you are running
  • the version of node.js you are running
  • the OS and terminal you are using

Note that the last version of Terminal-kit needs at least Node v4.

@singggum3b
Copy link
Author

Hi @cronvel
I'm using terminal kit on node v5.3 - opensuse leap gnome , terminal-kit 0.21.8.
The parent terminal is tty.
It's working fine in node environment, but not working when i require it via Meteor's Npm.require.

I' m guessing it's because of Meteor JS engine (missing prototype when require core module events)

@cronvel
Copy link
Owner

cronvel commented Jan 4, 2016

Can you confirm that, by running in meteor the code:

if (Meteor.isServer) {
  Meteor.startup(function () {
    console.log( 'Node: ' + process.version ) ;
    console.log( 'Versions: ' , process.versions ) ;
  });
}

I just downloaded Meteor (I never tried it until now), and while I have Node v4.2.2 installed on my system, Meteor seems to use Node v0.10.40.

Here is what I get:

I20160104-10:28:50.446(1)? Node: v0.10.40
I20160104-10:28:50.447(1)? Versions:  { http_parser: '1.0',
I20160104-10:28:50.447(1)?   node: '0.10.40',
I20160104-10:28:50.448(1)?   v8: '3.14.5.9',
I20160104-10:28:50.448(1)?   ares: '1.9.0-DEV',
I20160104-10:28:50.448(1)?   uv: '0.10.36',
I20160104-10:28:50.448(1)?   zlib: '1.2.8',
I20160104-10:28:50.448(1)?   modules: '11',
I20160104-10:28:50.449(1)?   openssl: '1.0.1p' }

By the way, the same in plain Node:

Node: v4.2.2
Versions:  { http_parser: '2.5.0',
  node: '4.2.2',
  v8: '4.5.103.35',
  uv: '1.7.5',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '56.1',
  modules: '46',
  openssl: '1.0.2d' }

Of course, I'm totally new to meteor, so I may have done something bad somewhere.

It looks like meteor download and run its own instance of Mongodb, what about Node? Does it ship its own Node.js? Does it support the ES6 feature included in Node v4?

Also, events.prototype should exist since Node/io-js v1 if I remember well (before that, one should use events.EventEmitter.prototype instead).

@singggum3b
Copy link
Author

Here's my output:

I20160104-16:51:22.788(7)? Node: v0.10.40
I20160104-16:51:22.789(7)? Versions:  { http_parser: '1.0',
I20160104-16:51:22.789(7)?   node: '0.10.40',
I20160104-16:51:22.790(7)?   v8: '3.14.5.9',
I20160104-16:51:22.790(7)?   ares: '1.9.0-DEV',
I20160104-16:51:22.790(7)?   uv: '0.10.36',
I20160104-16:51:22.790(7)?   zlib: '1.2.8',
I20160104-16:51:22.790(7)?   modules: '11',
I20160104-16:51:22.790(7)?   openssl: '1.0.1p' }

Here's what require("events) look like:

I20160104-16:51:22.827(7)? { usingDomains: false,
I20160104-16:51:22.827(7)?   EventEmitter: { [Function: EventEmitter] listenerCount: [Function] } }

It's seem like meteorJS ship with its own node version , which cause the issue.
ES6 can be added with ecmascript package , but that doesn't help either.

Do you think this 'll be a simple patch ( check prototype if exist?), or it'll take a lot of rework to support?
I don't think meteor can use external nodejs version :(

@singggum3b
Copy link
Author

Related issue on meteor : meteor/meteor#5124

@cronvel
Copy link
Owner

cronvel commented Jan 4, 2016

If the core event module is the only failing dependency, I can patch it. Stay tuned ;)

@singggum3b
Copy link
Author

👍

@cronvel
Copy link
Owner

cronvel commented Jan 4, 2016

What exactly do you want to achieve with Terminal-kit?

I managed to get basic features to work as of terminal-kit@v0.22.0, colors and style are working as expected now.

However, Meteor interfere with the TTY, and as a result Terminal-kit cannot grab inputs.

If you just want colorful log, that's ok.

BTW I guess you don't want to create an interactive terminal application.

@singggum3b
Copy link
Author

I'm writing an solution to allow meteor using external build instead of relying on isobuild.
I'm using terminal-kit to serve as info logger & replacement of charm in progressor.
I just stumble on the issue on accident when testing the server build.

Thanks you for fast response & amazing support 👍

Btw IMO terminal kit come with many bloat feature(like progress bar).
I think you should consider split it up to core and utility packages

Cheers.

@cronvel
Copy link
Owner

cronvel commented Jan 4, 2016

Thanks for your feedback. If you have trouble, let me know! ;)

@cronvel
Copy link
Owner

cronvel commented Jan 5, 2016

I have good news for you!

I have added a new built-in terminal instance that might interest you.

Instead of using: Npm.require( "terminal-kit" ).terminal, try using Npm.require( "terminal-kit" ).realTerminal.

Using this, you gain access to the real TTY and totally hijack all the meteor stuffs that get in the way when terminal-kit try to read/write from STDIN and STDOUT.

This terminal instance also escape from pipe.

Using that, you can even use all terminal-kit interactive features, if you need.
BTW, meteor will still occasionally write things down to the terminal.

@singggum3b
Copy link
Author

Hey @cronvel , i'm glad you was able to patch it . Great update!
I'll try it as soon as i can.
Sorry for the late reply, i'm too busy these days.
Cheers.

@cronvel cronvel closed this as completed Jan 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants