Open Shamo84 opened 1 year ago
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
?
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
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
Try use prettier 2.8.8 instead of 3.0
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 https://github.com/prettier/plugin-php/issues/2215#issuecomment-1684376930
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".