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

Breaks when used in browser with browserify #22

Closed
0815fox opened this issue Jul 26, 2017 · 6 comments
Closed

Breaks when used in browser with browserify #22

0815fox opened this issue Jul 26, 2017 · 6 comments

Comments

@0815fox
Copy link

0815fox commented Jul 26, 2017

When using in browser with browserify, recent builds break with the message:

>> Error: Cannot find module 'spawn-sync' from './node_modules/cross-spawn'

The issue is, that there is no spawn-sync for browsers as spawning is not possible, I guess. So cross-spawn only works in node. I don't know if it was ever intended, but previous versions (until 2.2.x) worked great in the browsers console...
From Version 2.3.0 until the most recent versions, it does not work anymore.

$ npm ls cross-spawn
analyzer
└─┬ tty-table@2.5.3
  └─┬ yargs@8.0.2
    └─┬ os-locale@2.1.0
      └─┬ execa@0.7.0
        └── cross-spawn@5.1.0 

For now I am sticking with version 2.2.5, as my module must work in node.js and browsers, using the table as debug output.

@tecfu
Copy link
Owner

tecfu commented Jul 27, 2017

Which browser are you using? What version / OS?

@0815fox
Copy link
Author

0815fox commented Jul 27, 2017 via email

@tecfu
Copy link
Owner

tecfu commented Jul 27, 2017

Commit d2d762c should fix this, as I've added yargs to the browserify package ignore list.

Could you check and see if version 2.5.4 works for you? The new changes are now in the master branch under /dist.

@0815fox
Copy link
Author

0815fox commented Jul 27, 2017 via email

@tecfu
Copy link
Owner

tecfu commented Jul 27, 2017

Still breaks after d2d762c.

@tecfu
Copy link
Owner

tecfu commented Mar 11, 2020

Browser colors work now that chalk has been replaced by kleur in the browser.

To test locally using a containerized apache instance running on port 8070 as your webserver:

git clone https://github.com/tecfu/tty-table
cd tty-table
docker run -dit --name my-apache-app -p 8070:80 -v "$PWD":/usr/local/apache2/htdocs/ httpd:2.4

In your browser navigate to http://localhost:8070/examples/browser-example.html

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