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

it did not work in Windows #92

Closed
lihchweb opened this issue Jan 7, 2019 · 7 comments
Closed

it did not work in Windows #92

lihchweb opened this issue Jan 7, 2019 · 7 comments

Comments

@lihchweb
Copy link

lihchweb commented Jan 7, 2019

my code:

const ora = require('ora');
 
const spinner = ora('Loading unicorns').start();
 
setTimeout(() => {
    spinner.color = 'yellow';
    spinner.text = 'Loading rainbows';
}, 1000);

when i use git bush to build my project, it do not work.

i check the issues above, however i am still puzzled。
help !

@eidellev
Copy link

eidellev commented Jan 9, 2019

Hi,
I'm also experiencing some issues on windows.
I see dash character, but it is not animated.

@ipatalas
Copy link

ipatalas commented Jan 28, 2019

It actually does work on Windows. It's just the default terminal that cannot display Unicode characters.
The following line falls back to a basic dash animation when on Windows.

ora/index.js

Line 26 in bbc82a4

this.spinner = typeof sp === 'object' ? sp : (process.platform === 'win32' ? cliSpinners.line : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line no-nested-ternary

I made a change there to force dot spinner and v'oila:

ora

It does require a better console though. I'm using ConEmu, cmder will do as well (based on ConEmu).
The question is how to enable it so that nothing breaks. The only reasonable option I can see is to introduce an environment variable to allow skipping OS check explicitly.

I can make a PR if that's acceptable to @sindresorhus

@lihchweb
Copy link
Author

It actually does work on Windows. It's just the default terminal that cannot display Unicode characters.
The following line falls back to a basic dash animation when on Windows.
ora/index.js

Line 26 in bbc82a4

this.spinner = typeof sp === 'object' ? sp : (process.platform === 'win32' ? cliSpinners.line : (cliSpinners[sp] || cliSpinners.dots)); // eslint-disable-line no-nested-ternary
I made a change there to force dot spinner and v'oila:

ora

It does require a better console though. I'm using ConEmu, cmder will do as well (based on ConEmu).
The question is how to enable it so that nothing breaks. The only reasonable option I can see is to introduce an environment variable to allow skipping OS check explicitly.

I can make a PR if that's acceptable to @sindresorhus

You're absolutely right about that.
The reason is that terminal cannot display Unicode characters.
Then I tried ConEmu,now I love it.
thank you very much!!!

@lihchweb
Copy link
Author

Hi,
I'm also experiencing some issues on windows.
I see dash character, but it is not animated.

you can see the newest answer. i think it will be helpful.

@ipatalas
Copy link

You're absolutely right about that.
The reason is that terminal cannot display Unicode characters.
Then I tried ConEmu,now I love it.
thank you very much!!!

You're welcome :) I fell in love with it from first use :)
It also works from other shells running under ConEmu which is for instance Git Bash or bash from WSL.
Now I think that we don't need a special flag for that. We could autodetect ConEmu based on its dedicated env vars.
They will be "visible" when app is running under ConEmu based console.
https://conemu.github.io/en/ConEmuEnvironment.html

@lihchweb
Copy link
Author

You're absolutely right about that.
The reason is that terminal cannot display Unicode characters.
Then I tried ConEmu,now I love it.
thank you very much!!!

You're welcome :) I fell in love with it from first use :)
It also works from other shells running under ConEmu which is for instance Git Bash or bash from WSL.
Now I think that we don't need a special flag for that. We could autodetect ConEmu based on its dedicated env vars.
They will be "visible" when app is running under ConEmu based console.
https://conemu.github.io/en/ConEmuEnvironment.html

My English is poor so that I cannot understand all your mean about ConEmu env.
What a pity.

@sindresorhus
Copy link
Owner

I'm not interested in an environment variable. That creates a leaky abstraction where every package using Ora needs to document those variables too. I'm happy to accept a good PR that adds checks for specific terminals if it's guaranteed, no matter what, that they support the full Unicode range.

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

4 participants