prettier: Prettier couldn't go through the directories recursively [error] EISDIR: illegal operation on a directory, read

Hi guys. I assume that it’s not probably connected to the prettier. But I gave up already to fix that somehow, cause it’s the only node based tool which doesn’t work with GLOB pattern for now.

Mac OS High Sierra Latest node and npm. prettier: 1.9.0

prettier --write {scripts,config,bin}/**/*

throws lot’s of errors in my face like:

bin/react-scripts.js 58ms
config/custom-react-scripts
[error] Unable to read file: config/custom-react-scripts
[error] EISDIR: illegal operation on a directory, read
config/env.js 26ms
config/jest
[error] Unable to read file: config/jest
[error] EISDIR: illegal operation on a directory, read
config/paths.js 31ms
config/polyfills.js 6ms
config/webpack.config.dev.js 34ms
config/webpack.config.prod.js 44ms
config/webpackDevServer.config.js 9ms
scripts/build.js 17ms
scripts/eject.js 33ms
scripts/init.js 26ms
scripts/start.js 8ms
scripts/test.js 6ms
scripts/utils
[error] Unable to read file: scripts/utils
[error] EISDIR: illegal operation on a directory, read
template/README.md 819ms

In the same, this script returns all required files in the deeply nested paths with no arguing.

require('glob')('{scripts,config,bin}/**/*', (e, f) => console.log(f));

I have prettier of the same version (1.9.0) both installed globally as well as the prettier in the package.json.

I tried to call it with sudo and tried to reinstall it etc. not much of a result. Running it through the npm scripts or directly result in the same output.

Node and npm are the latest and were installed using brew. I’m under administrator profile.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Fixed in 1.9.1!

Can you try running with quotes around the glob? i.e.

prettier --write "{scripts,config,bin}/**/*"

Without quotes, your shell is actually passing the list of files already expanded. With quotes, you’re passing to prettier the glob and prettier will take of care of expanding and will only select files.

See here for more information: https://prettier.io/docs/en/cli.html