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

CLI broken when output path is not set #933

Closed
zmwangx opened this issue May 10, 2016 · 6 comments
Closed

CLI broken when output path is not set #933

zmwangx opened this issue May 10, 2016 · 6 comments
Milestone

Comments

@zmwangx
Copy link
Contributor

zmwangx commented May 10, 2016

Update. Only broken in node 6.0.0 or later.


I'm running the latest master (bdb91a2).

On the command line:

> js-beautify foo.js

Expected: beautified result printed to stdout. Instead:

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.dirname (path.js:1324:5)
    at Object.processInputSync (/usr/local/lib/node_modules/js-beautify/js/lib/cli.js:318:24)
    at Array.forEach (native)
    at Object.exports.interpret (/usr/local/lib/node_modules/js-beautify/js/lib/cli.js:205:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/js-beautify/js/bin/js-beautify.js:4:5)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
Run `js-beautify -h` for help.

There's no such error when a custom output path is specified using -o, --outfile.

The problem appears to be config.outfile being undefined.

@riatzukiza
Copy link

I recieve this same problem. It happens to me when I am using the web-beautify-js tool in spacemacs, which uses js-beautify via CLI to pipe the input into the emacs buffer, this was working until recently, then stopped after I updated node js to 6.0.0. I have updated the application since then and I still recieve this problem.

@riatzukiza
Copy link

I will back port to an older version of node to see if this is resolved.

@zmwangx
Copy link
Contributor Author

zmwangx commented May 18, 2016

Now that you mention it, yes, it's broken by node 6.0.0. Works fine under 5.11.0.

By the way, I also noticed this problem when the web-beautify package stopped working.

@riatzukiza
Copy link

I just downgraded to 4.4.4, the latest stable version of node, and it does indeed work.

@bitwiseman
Copy link
Member

@riatzukiza, @zmwangx - Thanks for tracking this down to version issues. I'll update the test environments to include nodejs 6.x and see if this can be tracked down.

@zmwangx
Copy link
Contributor Author

zmwangx commented May 21, 2016

Fix in #939.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants