-
Notifications
You must be signed in to change notification settings - Fork 450
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
Always returns Could not find 'php-cs-fixer'. The program may not be installed for PHP #394
Comments
Did you see the message:
? If not, then there is a big issue that I should look into because it should tell you to setup Atom Beautify and configure it for PHP-CS-Fixer. Have you configured Atom Beautify with the absolute path to |
I do see that error yes. Then I install PHP-CS-Fixer. Last night I tried it via Atom settings. I was experimenting and had it in my downloads folder. Set the path in the PHP-CS-FIXER to Users/username/Downloads/ Tried it as the path to the folder, also tried it as Users/username/Downloads/php-cs-fixer which also created the same Uncaught Error. Today, tried installing everything via the command line (Beautify and PHP-CS-Fixer and it's dependencies) and followed all the commands listed there for installation. Neither package worked for PHP. Set the path in Beautify as /Users/username/php-cs-fixer.phar, /Users/username/php-cs-fixer, /Users/username/ -- none of which worked either. All gave me the same "Could not find 'php-cs-fixer'. The program may not be installed." Error. I'm probably making some stupid error on setting the path or such so hopefully someone can point out what I'm missing... |
It looks like you are running on Mac. Mac does not use the So this usually indicates that the Mac is not setup properly. Let's try and figure this out. Could you open your Terminal and confirm:
|
Thanks. Here are what was returned:
The following debugging information was generated by Platform: darwin VersionsAtom Version: 0.208.0 Atom Beautify Version: 0.28.2 Original file to be beautifiedOriginal File Path: Original File Grammar: PHP Original File Contents: phpinfo() Beautification optionsEditor Options: {
"_default": {
"indent_size": 4,
"indent_char": " ",
"indent_with_tabs": false
}
} Config Options: {
"php": {
"cs_fixer_path": "/Users/username/",
"fixers": "linefeed,-short_tag,indentation",
"level": ""
},
"cs": {
"configPath": ""
},
"c": {
"configPath": ""
},
"cpp": {
"configPath": ""
},
"css": {
"indent_size": 4,
"indent_char": " ",
"selector_separator_newline": false,
"newline_between_rules": false,
"preserve_newlines": false,
"wrap_line_length": 0,
"indent_comments": true,
"force_indentation": false,
"convert_quotes": "none",
"align_assignments": false
},
"d": {
"configPath": ""
},
"fortran": {
"emacs_path": "",
"emacs_script_path": ""
},
"html": {
"indent_inner_html": false,
"indent_size": 4,
"indent_char": " ",
"brace_style": "collapse",
"indent_scripts": "normal",
"wrap_line_length": 250,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 4,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"unformatted": [
"a",
"sub",
"sup",
"b",
"i",
"u"
],
"end_with_newline": false
},
"java": {
"configPath": ""
},
"js": {
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"space_in_paren": false,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"break_chained_methods": false,
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0,
"end_with_newline": false
},
"objectivec": {
"configPath": ""
},
"pawn": {
"configPath": ""
},
"perl": {
"perltidy_profile": ""
},
"python": {
"max_line_length": 79,
"indent_size": 4,
"ignore": [
"E24"
]
},
"ruby": {
"indent_size": 4
},
"rust": {
"rustfmt_path": ""
},
"sql": {
"indent_size": 4,
"keywords": "upper",
"identifiers": "lower"
},
"vala": {
"configPath": ""
}
} Home Options: {
"_default": {}
} EditorConfig Options: {
"_default": {}
} Project Options: [
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
}
] ResultsBeautified File Contents: Error: Could not find 'php-cs-fixer'. The program may not be installed. Logs:
|
This makes total sense why it's not working then. It's not even setup properly. You need to add the directory you installed
That should do it. You can test installation again with |
Makes sense and I did finally get it to work. I couldn't seem to get the homebrew option to install successfully, but the Composer version worked fine. I'm adding my steps here so it's documented for anyone else who might have this problem. 1. Install Composer (https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx) 2. Install PHP-CS-Fixer (https://github.com/FriendsOfPHP/PHP-CS-Fixer) That got everything working for me. |
Excellent! Thank you for documenting. I am working on Beautifier-specific documentation and will add your findings to those docs. I also am currently developing improvements to Atom Beautify for how it notifies users when there are problems, and tries to help them debug the issues. Here is a sample error message:
What else do you think needs to be said to make sure other users do not create so many Issues on Atom Beautify and instead use the error message as guidance to resolve their problem on their own? I find myself writing the exact same comments in Issues and I want to automate this a lot more and encourage users (who are supposedly developers) to problem solve on their own. If I can give them sufficient information of what is going on, then maybe they could get it working on their own, without posting an issue and waiting for me to reply and debug with them over many days. |
Published the above changes to v0.28.3 |
Yeah, the previous error message wasn't really actionable or easy to understand. Take it or leave it, but I would say something like the below — this isn't exactly perfect, but I think it would get some of the multiple requests off your plate (also, I'm coming from the Mac so I don't know if this all is accurate for Windows, etc.) In Atom:
Web-side Documentation:
|
Thanks for your feedback, @dtomasch! I am currently adding some more tests, however once I am done that I will be going back to documentation and bringing over what you said into the official docs. Thanks! |
FWIW, I just went through this thread and following the conversation helped me solve my issue. |
Great to hear @BMOv2600! I want to go back to the above conversation and
|
I am so sorry that I have to bump this thread up again. I followed this thread's step but still can't make it work.
Atom Beautify - Debugging informationThe following debugging information was generated by Platform: darwin VersionsAtom Version: 1.0.9 Atom Beautify Version: 0.28.11 Original file to be beautifiedOriginal File Path: Original File Grammar: PHP Original File Language: PHP Original File Contents: <?
phpinfo();
?> Beautification optionsEditor Options: {
"_default": {
"indent_size": 2,
"indent_char": " ",
"indent_with_tabs": false
}
} Config Options: {
"css": {
"convert_quotes": "single",
"indent_size": 2,
"indent_char": " ",
"selector_separator_newline": false,
"newline_between_rules": false,
"preserve_newlines": false,
"wrap_line_length": 0,
"indent_comments": true,
"force_indentation": false,
"align_assignments": false
},
"html": {
"end_with_newline": true,
"max_preserve_newlines": 2,
"indent_inner_html": false,
"indent_size": 2,
"indent_char": " ",
"brace_style": "collapse",
"indent_scripts": "normal",
"wrap_line_length": 250,
"wrap_attributes": "auto",
"wrap_attributes_indent_size": 2,
"preserve_newlines": true,
"unformatted": [
"a",
"sub",
"sup",
"b",
"i",
"u"
]
},
"js": {
"end_with_newline": true,
"eval_code": true,
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 10,
"space_in_paren": false,
"jslint_happy": false,
"space_after_anon_function": false,
"brace_style": "collapse",
"break_chained_methods": false,
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"unescape_strings": false,
"wrap_line_length": 0
},
"php": {
"cs_fixer_path": "/usr/local/bin/php-cs-fixer",
"fixers": "",
"level": ""
},
"arduino": {
"configPath": ""
},
"cs": {
"configPath": ""
},
"c": {
"configPath": ""
},
"cpp": {
"configPath": ""
},
"d": {
"configPath": ""
},
"gherkin": {
"indent_size": 2,
"indent_char": " "
},
"fortran": {
"emacs_path": "",
"emacs_script_path": ""
},
"java": {
"configPath": ""
},
"objectivec": {
"configPath": ""
},
"pawn": {
"configPath": ""
},
"perl": {
"perltidy_profile": ""
},
"python": {
"max_line_length": 79,
"indent_size": 4,
"ignore": [
"E24"
]
},
"ruby": {
"indent_size": 2,
"indent_char": " "
},
"rust": {
"rustfmt_path": ""
},
"sql": {
"indent_size": 2,
"keywords": "upper",
"identifiers": "lower"
},
"vala": {
"configPath": ""
}
} Home Options: {
"_default": {}
} EditorConfig Options: {
"_default": {}
} Project Options: [
{
"_default": {}
},
{
"_default": {}
},
{
"_default": {}
}
] Final Options: {
"indent_size": 2,
"indent_char": " ",
"indent_with_tabs": false
} Package Settings: {
"_analyticsUserId": "c603447f-e71c-455b-a0cc-49a42d18aaa6",
"analytics": false,
"css_convert_quotes": "single",
"html_end_with_newline": true,
"language_html_beautify_on_save": true,
"language_scss_beautify_on_save": true,
"language_js_beautify_on_save": true,
"js_end_with_newline": true,
"js_eval_code": true,
"html_max_preserve_newlines": 2,
"language_json_beautify_on_save": true,
"php_cs_fixer_path": "/usr/local/bin/php-cs-fixer",
"_loggerLevel": "warn",
"beautifyEntireFileOnSave": true,
"muteUnsupportedLanguageErrors": false,
"muteAllErrors": false,
"arduino_configPath": "",
"cs_configPath": "",
"c_configPath": "",
"cpp_configPath": "",
"css_indent_size": 2,
"css_indent_char": " ",
"css_selector_separator_newline": false,
"css_newline_between_rules": false,
"css_preserve_newlines": false,
"css_wrap_line_length": 0,
"css_indent_comments": true,
"css_force_indentation": false,
"css_align_assignments": false,
"d_configPath": "",
"gherkin_indent_size": 2,
"gherkin_indent_char": " ",
"fortran_emacs_path": "",
"fortran_emacs_script_path": "",
"html_indent_inner_html": false,
"html_indent_size": 2,
"html_indent_char": " ",
"html_brace_style": "collapse",
"html_indent_scripts": "normal",
"html_wrap_line_length": 250,
"html_wrap_attributes": "auto",
"html_wrap_attributes_indent_size": 2,
"html_preserve_newlines": true,
"html_unformatted": [
"a",
"sub",
"sup",
"b",
"i",
"u"
],
"java_configPath": "",
"js_indent_size": 2,
"js_indent_char": " ",
"js_indent_level": 0,
"js_indent_with_tabs": false,
"js_preserve_newlines": true,
"js_max_preserve_newlines": 10,
"js_space_in_paren": false,
"js_jslint_happy": false,
"js_space_after_anon_function": false,
"js_brace_style": "collapse",
"js_break_chained_methods": false,
"js_keep_array_indentation": false,
"js_keep_function_indentation": false,
"js_space_before_conditional": true,
"js_unescape_strings": false,
"js_wrap_line_length": 0,
"objectivec_configPath": "",
"pawn_configPath": "",
"perl_perltidy_profile": "",
"php_fixers": "",
"php_level": "",
"python_max_line_length": 79,
"python_indent_size": 4,
"python_ignore": [
"E24"
],
"ruby_indent_size": 2,
"ruby_indent_char": " ",
"rust_rustfmt_path": "",
"sql_indent_size": 2,
"sql_keywords": "upper",
"sql_identifiers": "lower",
"vala_configPath": "",
"language_arduino_disabled": false,
"language_arduino_default_beautifier": "Uncrustify",
"language_arduino_beautify_on_save": false,
"language_cs_disabled": false,
"language_cs_default_beautifier": "Uncrustify",
"language_cs_beautify_on_save": false,
"language_c_disabled": false,
"language_c_default_beautifier": "Uncrustify",
"language_c_beautify_on_save": false,
"language_coffeescript_disabled": false,
"language_coffeescript_default_beautifier": "coffee-fmt",
"language_coffeescript_beautify_on_save": false,
"language_cpp_disabled": false,
"language_cpp_default_beautifier": "Uncrustify",
"language_cpp_beautify_on_save": false,
"language_css_disabled": false,
"language_css_default_beautifier": "JS Beautify",
"language_css_beautify_on_save": false,
"language_csv_disabled": false,
"language_csv_default_beautifier": "Pretty Diff",
"language_csv_beautify_on_save": false,
"language_d_disabled": false,
"language_d_default_beautifier": "Uncrustify",
"language_d_beautify_on_save": false,
"language_ejs_disabled": false,
"language_ejs_default_beautifier": "Pretty Diff",
"language_ejs_beautify_on_save": false,
"language_erb_disabled": false,
"language_erb_default_beautifier": "Pretty Diff",
"language_erb_beautify_on_save": false,
"language_gherkin_disabled": false,
"language_gherkin_default_beautifier": "Gherkin formatter",
"language_gherkin_beautify_on_save": false,
"language_go_disabled": false,
"language_go_default_beautifier": "gofmt",
"language_go_beautify_on_save": false,
"language_fortran_disabled": false,
"language_fortran_default_beautifier": "Fortran Beautifier",
"language_fortran_beautify_on_save": false,
"language_handlebars_disabled": false,
"language_handlebars_default_beautifier": "JS Beautify",
"language_handlebars_beautify_on_save": false,
"language_html_disabled": false,
"language_html_default_beautifier": "JS Beautify",
"language_java_disabled": false,
"language_java_default_beautifier": "Uncrustify",
"language_java_beautify_on_save": false,
"language_js_disabled": false,
"language_js_default_beautifier": "JS Beautify",
"language_json_disabled": false,
"language_json_default_beautifier": "JS Beautify",
"language_jsx_disabled": false,
"language_jsx_default_beautifier": "Pretty Diff",
"language_jsx_beautify_on_save": false,
"language_less_disabled": false,
"language_less_default_beautifier": "Pretty Diff",
"language_less_beautify_on_save": false,
"language_markdown_disabled": false,
"language_markdown_default_beautifier": "Tidy Markdown",
"language_markdown_beautify_on_save": false,
"language_marko_disabled": false,
"language_marko_default_beautifier": "JS Beautify",
"language_marko_beautify_on_save": false,
"language_mustache_disabled": false,
"language_mustache_default_beautifier": "JS Beautify",
"language_mustache_beautify_on_save": false,
"language_objectivec_disabled": false,
"language_objectivec_default_beautifier": "Uncrustify",
"language_objectivec_beautify_on_save": false,
"language_pawn_disabled": false,
"language_pawn_default_beautifier": "Uncrustify",
"language_pawn_beautify_on_save": false,
"language_perl_disabled": false,
"language_perl_default_beautifier": "Perltidy",
"language_perl_beautify_on_save": false,
"language_php_disabled": false,
"language_php_default_beautifier": "PHP-CS-Fixer",
"language_php_beautify_on_save": false,
"language_puppet_disabled": false,
"language_puppet_default_beautifier": "puppet-lint",
"language_puppet_beautify_on_save": false,
"language_python_disabled": false,
"language_python_default_beautifier": "autopep8",
"language_python_beautify_on_save": false,
"language_ruby_disabled": false,
"language_ruby_default_beautifier": "Rubocop",
"language_ruby_beautify_on_save": false,
"language_rust_disabled": false,
"language_rust_default_beautifier": "rustfmt",
"language_rust_beautify_on_save": false,
"language_sass_disabled": false,
"language_sass_default_beautifier": "Pretty Diff",
"language_sass_beautify_on_save": false,
"language_scss_disabled": false,
"language_scss_default_beautifier": "Pretty Diff",
"language_spacebars_disabled": false,
"language_spacebars_default_beautifier": "Pretty Diff",
"language_spacebars_beautify_on_save": false,
"language_sql_disabled": false,
"language_sql_default_beautifier": "sqlformat",
"language_sql_beautify_on_save": false,
"language_svg_disabled": false,
"language_svg_default_beautifier": "Pretty Diff",
"language_svg_beautify_on_save": false,
"language_swig_disabled": false,
"language_swig_default_beautifier": "Pretty Diff",
"language_swig_beautify_on_save": false,
"language_tss_disabled": false,
"language_tss_default_beautifier": "Pretty Diff",
"language_tss_beautify_on_save": false,
"language_twig_disabled": false,
"language_twig_default_beautifier": "Pretty Diff",
"language_twig_beautify_on_save": false,
"language_typescript_disabled": false,
"language_typescript_default_beautifier": "TypeScript Formatter",
"language_typescript_beautify_on_save": false,
"language_vala_disabled": false,
"language_vala_default_beautifier": "Uncrustify",
"language_vala_beautify_on_save": false,
"language_visualforce_disabled": false,
"language_visualforce_default_beautifier": "Pretty Diff",
"language_visualforce_beautify_on_save": false,
"language_xml_disabled": false,
"language_xml_default_beautifier": "Pretty Diff",
"language_xml_beautify_on_save": false
} ResultsBeautified File Contents: Error: Could not find 'php-cs-fixer'. The program may not be installed. Logs:
|
@gddabe : I think the problem is with your You noted that it should be:
However, when I look at the debugging logs:
It shows a few things:
I just ran mine, which is setup and working, and the log line look like:
Note the difference, Could you verify that your PATH environment variable is saved properly? For instance, try restarting your Terminal and running Let me know if you have any more questions. I hope this resolves your problem. I believe that the issue is that you need to store your changes to your |
@Glavin001 thanks for your reply!
to double ensure it is set. But still no luck.
|
Your know what, after several hours of researching, I was just too frustrated because of this, I reinstall atom and BOOM! It works all of a sudden! That's soooooo weird. But who cares, it works now, thanks for you support @Glavin001! |
Glad to hear it is working now! Let me know if you have any more questions 😃 . |
After debugging all of that last year, now I can't get this working again… despite walking thru all of my own original documented instructions. It doesn't fail with an error like it used to, and php-cs-fixer is installed. What data do you need to help debug? |
@dtomasch : Follow the |
Thanks! Here's the link: https://gist.github.com/dtomasch/bb9a62d17b7629f63277c3d498c445bf |
@dtomasch : What do you think is wrong? What do you expect to happen? The logs indicate that Atom-Beautify is working correctly and php-cs-fixer has completed. In your logs:
|
@Glavin001 — insteresting. The outpout doesn't repopulate the current document. So effectively it's not doing anything to my php file. See below: Original PHP file (partial, used as in include): |
It looks like the contents is all HTML. I'd suppose that PHP-CS-Fixer is not handling any of the HTML? You could ask them at https://github.com/FriendsOfPHP/PHP-CS-Fixer Issue #457 may also be related and this comment describes my future plans: #457 (comment) |
That makes sense; I did think I had it working. This is def part of issue #457 — the other solution is to change your grammar but that's a bit of a pain. (I didn't mean to close this issue necessarily) |
@dtomasch Thank you...! |
So it would seem that everyone here has resolved the issues on Linux. But what about Windows? Today, I installed Atom, I have php installed (xampp) and I installed both atom-beautify and php-cs-fixer. Here is the error I get:
|
Seems that it simply does not word on Windows.. Tells me not found.. |
For macOS Sierra I had this problem also.
I fix the problem in this way:
In the End I can use this beauty… |
+1 |
I really want to focus on improving the installation experience for users. I have created a new Issue, #1687, to target this problem. Please provide your feedback! Thanks in advance. |
@dtomasch @Glavin001 where should I apply those commands ? what is the path I must apply those commands in in order to check php-cs-fixer or install it ? |
hmm, on windows: |
Not working to me too :(
Here is log: https://gist.github.com/cpjeanpaul/c4aa6e81182d19a59b703b5cfa5a24fa |
@cpjeanpaul : In your logs I see:
|
I think there are some problemes with v2.x. Now I'm using 1.x and is working. Thank you for your patience ;) |
Thank you so much @dtomasch I also got it fixed the way you showed! |
@brutalcrozt Thanks, |
Thanks its work |
Could not find 'php-cs-fixer'. The program may not be installed. See php-cs-fixer installation instructions at https://github.com/Glavin001/atom-beautify#beautifiers or go to https://github.com/FriendsOfPHP/PHP-CS-Fixer |
how to solve this problem |
Just Only this command working perfectly |
it's working for me, thanks. |
Installed the php-cs-fixer pacakge; still cannot get it to beautify PHP
The text was updated successfully, but these errors were encountered: