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

fatal: unable to read files to diff #1

Open
ariselseng opened this issue Jan 18, 2018 · 14 comments · Fixed by #2
Open

fatal: unable to read files to diff #1

ariselseng opened this issue Jan 18, 2018 · 14 comments · Fixed by #2

Comments

@ariselseng
Copy link

$ prettier-diff 
diff --git a/app-icon.png b/app-icon.png
old mode 100644
new mode 100755
index a4b70c6..1fb3ba1
fatal: unable to read files to diff

This happens on all repos I have.

I am using Ubuntu 17.10, and have git version 2.14.1.

@josephfrazier
Copy link
Owner

josephfrazier commented Jan 18, 2018

I think this is because the underlying prettier_d process died, but the ~/.prettier_d file is still present (this happens when you reboot your machine). Try removing ~/.prettier_d and rerunning prettier-diff.

josephfrazier added a commit that referenced this issue Jan 20, 2018
josephfrazier added a commit that referenced this issue Jan 20, 2018
josephfrazier added a commit that referenced this issue Jan 20, 2018
@josephfrazier
Copy link
Owner

This should be fixed in v0.0.15 (just published)!

@ariselseng
Copy link
Author

Great! Thank you:) You were totally right about it being prettier_d file that was present.

@josephfrazier
Copy link
Owner

Sure thing! I had definitely encountered this problem as well, but just hadn't gotten around to fixing it.

@sandangel
Copy link

I have the same error with the latest version, could you please confirm?

@josephfrazier
Copy link
Owner

@sandangel can you run the following and copy/paste the commands and output here:

rm ~/.prettier_d
prettier-diff --version
prettier-diff # put your arguments here

@sandangel
Copy link

hi @josephfrazier , there is no prettier-diff --version option.
I do a fresh install with yarn global add prettier-diff

$ yarn global add prettier-diff
yarn global v1.13.0
[1/4] 🔍  Resolving packages...
warning prettier-diff > prettier_d > sinon > nise > text-encoding@0.6.4: no longer maintained
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "@vue/cli > @vue/cli-ui > graphql-type-json@0.2.1" has unmet peer dependency "graphql@>=0.8.0".
[4/4] 🔨  Building fresh packages...
success Installed "prettier-diff@0.0.15" with binaries:
      - prettier-diff
      - textconv-prettier
✨  Done in 33.95s.
$ rm -rf ~/.prettier_d
$ prettier-diff --version

error: invalid option: --version
$ prettier-diff f9bef21 # previous commit

nc: invalid option -- q
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port] [--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
          [-s source_ip_address] [-w timeout] [-X proxy_version]
          [-x proxy_address[:port]] [hostname] [port[s]]
fatal: unable to read files to diff

@josephfrazier
Copy link
Owner

nc: invalid option -- q
usage: nc [-46AacCDdEFhklMnOortUuvz] [-K tc] [-b boundif] [-i interval] [-p source_port] [--apple-delegate-pid pid] [--apple-delegate-uuid uuid]
          [-s source_ip_address] [-w timeout] [-X proxy_version]
          [-x proxy_address[:port]] [hostname] [port[s]]

Ah, this is due to a difference in how nc works on Linux vs macOS. Your best bet is to open the prettier_dnc script (find it with which prettier_dnc) and delete the -q 0 from the nc command options. Let me know how it goes!

I've recently rewritten the prettier_d project (on which prettier-diff depends) and removed the prettier_dnc script, so if I get a chance, I'll likely update prettier-diff as well.

@sandangel
Copy link

hi @josephfrazier I think prettier-diff is using the latest commit from prettier_d
package.json

"prettier_d": "https://github.com/josephfrazier/prettier_d.js",

let me try editing the prettier_d script

@josephfrazier
Copy link
Owner

Oh good catch, I had forgotten about that. Yeah I'll probably have to change some things here before it'll work again

@josephfrazier josephfrazier reopened this Jan 10, 2019
@ariselseng
Copy link
Author

Is everything working now in prettier-diff?

(node:24005) UnhandledPromiseRejectionWarning: Error: Command failed: '/usr/lib/node_modules/prettier-diff/node_modules/.bin/prettier_d' start
/bin/sh: 1: /usr/lib/node_modules/prettier-diff/node_modules/.bin/prettier_d: not found

    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:653:13)
    at sh (/usr/lib/node_modules/prettier-diff/node_modules/shell-tag/index.js:7:12)
    at isPrettierdReachable.then.reachable (/usr/lib/node_modules/prettier-diff/bin/prettier-diff.js:36:7)
(node:24005) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24005) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@josephfrazier
Copy link
Owner

@cowai I just published version 0.0.16 that uses the prettier_d before I made it a fork of Prettier (and removed functionality that prettier-diff relies on), so give that a shot. I may move prettier-diff into the prettier_d repo in order to make it easier to keep in sync with Prettier, but that will have to come later.

@ariselseng
Copy link
Author

@josephfrazier
Which kind of OS and setup do you test on?
I am running Ubuntu 18.04 with nvm.sh @ Node 11.7 ( I have tested several)

fs.js:120
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:515:3)
    at tryReadSync (fs.js:338:20)
    at Object.readFileSync (fs.js:375:19)

@josephfrazier
Copy link
Owner

Unfortunately, I'm now on OSX (whereas I developed this on Ubuntu), and I don't currently use prettier-diff myself. I need to get TravisCI running here, so we have a good reference for whether things are working...

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

Successfully merging a pull request may close this issue.

3 participants