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

[error] No files matching the pattern were found: "path/to/file.php". #2119

Open
Shamo84 opened this issue Dec 6, 2022 · 5 comments
Open

Comments

@Shamo84
Copy link

Shamo84 commented Dec 6, 2022

so I installed this plugin globally with:

npm install --global prettier @prettier/plugin-php

but when I run prettier path/to/file.php --write

i get this error:
[error] No files matching the pattern were found: "path/to/file.php".

@czosel
Copy link
Collaborator

czosel commented Dec 10, 2022

Hi @Shamo84, I wasn't able to reproduce the issue:

$ npm install --global prettier @prettier/plugin-php


added 8 packages, and audited 9 packages in 5s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
$ prettier foo.php
<?php

if (true) {
    echo "foo";
}
$ prettier foo.php --write
foo.php 7ms
$ cat foo.php 
<?php

if (true) {
    echo "foo";
}

Can the file path be resolved when you replace prettier with any other command, e.g. ls?

@dantemogrim
Copy link

dantemogrim commented Dec 19, 2022

I'm getting a similar message using the package as a devDependency with Yarn:

$ yarn run prettier path/to/file.php --write

# Output:
# [error] No parser could be inferred for file: path/to/file.php

@andrei-dascalu
Copy link

Same issue for me.

Tried with node 20.4.0 with either yarn 1.22.19 or npm 9.7.2 under macos
Also tried with node 18.16.1 with either yarn 1.22.19 or nom 9.6.6 under alpine linux

fresh global install in all cases, the next call to prettier <file in current folder> results in No parser could be inferred for file

@Nyholm
Copy link

Nyholm commented Jul 21, 2023

Try use prettier 2.8.8 instead of 3.0

@jdeniau
Copy link
Contributor

jdeniau commented Aug 31, 2023

Hi @Shamo84 , I ran into a similar issue, and if you use prettier 3, you need to explicitly enable the plugin by passing --plugin @prettier/plugin-php in the cli, or "plugins": ["@prettier/plugin-php"] in your prettier file.

See #2215 (comment)

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

6 participants