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

Update v0.30.x throws error "Could not find 'PHP-CS-Fixer'. The program may not be installed." #1725

Closed
9585999 opened this issue Jun 18, 2017 · 33 comments
Assignees
Milestone

Comments

@9585999
Copy link

9585999 commented Jun 18, 2017

After the update, the PHP-CS-Fixer stopped working.

img 2017-06-18 11 46 14
img 2017-06-18 11 46 34
img 2017-06-18 11 48 50
img 2017-06-18 11 47 22

how to solve a problem?

@fenixjz
Copy link

fenixjz commented Jun 18, 2017

Same problem here.
Atom version 1.18.0
Win 10 x64

@9585999
Copy link
Author

9585999 commented Jun 18, 2017

I have...
img 2017-06-18 20 56 51
img 2017-06-18 20 57 12

@fenixjz
Copy link

fenixjz commented Jun 18, 2017

@9585999 Are you find solution?

@nicholas-ooi
Copy link

nicholas-ooi commented Jun 18, 2017

Facing same issue after update.
Using windows. Already set path via settings. However,
Error: Could not find 'php-cs-fixer'. The program may not be installed.

@Glavin001
Copy link
Owner

Glavin001 commented Jun 19, 2017

Hi everyone! I want to help solve this for you ASAP. The last release was specifically targeting improving the setup of third-party beautifiers (e.g. PHP-CS-Fixer) within Atom-Beautify. While all of my tests passed, I know this is a complicated matter and I need help for users like you to really make this experience great.

Please provide:

In the mean time, you could downgrade to the last release with apm install [email protected]. This issue is my top priority so expect release v0.30.1 soon! Thank you all for your patience!

@Glavin001
Copy link
Owner

Published patch to v0.30.1

Please provide the above information if the latest release does not improve things for you. Thanks!

@Glavin001 Glavin001 reopened this Jun 19, 2017
@Glavin001 Glavin001 changed the title Could not find 'PHP-CS-Fixer'. The program may not be installed. Update v0.30.x throws error "Could not find 'PHP-CS-Fixer'. The program may not be installed." Jun 19, 2017
@Glavin001
Copy link
Owner

For anyone experiencing this issue please provide the information I requested in #1725 (comment)
I hope to resolve this very soon. However, I have been unable to reproduce these issues -- it works on my machine 🙄 -- so I need some more data to work with. Thank you all for your patience!

@9585999
Copy link
Author

9585999 commented Jun 19, 2017

At me all works, now even in options atom-beatufy I do not register a way to php-cs-fixer.

Thanks for your work !

@fenixjz
Copy link

fenixjz commented Jun 19, 2017

Work on my Win 10x64. Tnx Glavin001.

@prasadfutballer
Copy link

PHPCBF was working perfectly recently until this happened in the new version, hope this gist is helpful for you to debug. Also tried adding the executables with no luck.
gist
Thanks for your hard work

@Glavin001
Copy link
Owner

Glavin001 commented Jun 19, 2017

Thanks, @prasadfutballer !

From your logs:

2017-06-19T08:17:11.568Z - debug: [] spawn done 0  PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)

2017-06-19T08:17:11.569Z - verbose: [] spawn result, returnCode 0
2017-06-19T08:17:11.569Z - verbose: [] spawn result, stdout PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)

2017-06-19T08:17:11.569Z - verbose: [] spawn result, stderr 
2017-06-19T08:17:11.569Z - info: [] Version text: PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net)

2017-06-19T08:17:11.569Z - error: []  Error: Version is not valid: null
    at /home/mindset/.atom/packages/atom-beautify/src/beautifiers/executable.coffee:96:21

Note when phpcbf --version is run the response is PHP_CodeSniffer version 3.0.1 (stable) by Squiz (http://www.squiz.net). This is not being correctly handled at

args: ['--version']
. By default (which is how it currently is configured) it will expect the response to be exactly 3.0.1.

This should be a quick fix I will have to test out tomorrow and publish a new release. Until then, please downgrade so you can still be productive and I will fix this ASAP. Thanks!

@prasadfutballer
Copy link

No problem @Glavin001 ..Just to help you out I just updated PHPcodesniffer to 3.0.1 after this error occurred just to check out if that solves the problem. I previously had PHP_Codesniffer v2.6.0 with the same error.
Thank you :)

@zesda
Copy link

zesda commented Jun 19, 2017

Hi guys,

Ran the latest package update today (v 0.30.1) and having the same issue as what's been described above.

@Glavin001, here's the gist for my debug.md - hope it helps - https://gist.github.com/zesda/b39f127dcafe00a24128c1c406dac483

@Chitzi
Copy link

Chitzi commented Jun 19, 2017

Just installed. Same issue v 0.30.1

@nicholas-ooi
Copy link

Having this issue:

the "PHP - PHP-CS-Fixer Path (cs_fixer_path)" configuration option has been deprecated. Please switch to using the option named "Executables - PHP-CS-Fixer - Path" in Atom-Beautify package settings now.

Using Windows 10 64x, path of "which php-cs-fixer" exactly matches with atom beautify path required.

The path in atom beautify that I have placed ends with C:/php-cs-fixer.phar

from command line running php C:/php-cs-fixer.phar shows the available commands.

Not too sure what the error meant.

@9585999
Copy link
Author

9585999 commented Jun 19, 2017

@nicholas-ooi Try removing the php-cs-fixer path from the atom-beautify settings

@Glavin001
Copy link
Owner

@nicholas-ooi : @9585999 is correct. I will be removing the PHP - PHP-CS-Fixer Path configuration option later, in favour of the standardized and consistent "Executables" configuration options. Simply deleting the old entry (making it falsy) will remove this deprecation warning. See https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/php-cs-fixer.coffee#L92-L94 for applicable code.

@Glavin001
Copy link
Owner

@prasadfutballer would you be able to create a new issue with your info for specifically PHP CodeSniffer (PHPCBF)? Since PHP-CS-Fixer and PHPCBF will be different fixes. I'll try to fix it up tonight after work. Thanks!

Thank you everyone else for your debug.md. Keep them coming! I'm hoping by using a more consistent method -- i.e. the new Executables feature -- we will be able to finally polish off the workflow for setting up external beautifiers.

@nicholas-ooi
Copy link

Thanks for the clarification really appreciate it.
However, I removed the path. It threw me an error "Could not find 'php-cs-fixer'. The program may not be installed."

I tested "where.exe php-cs-fixer" and it gave me the absolute path.

I have also placed the relevant path in the ENV variable but still encountered same issue, since i tried to also shift the php-cs-fixer.phar in different folders. I know that the ENV works because I could type php-cs-fixer.phar in the command and it will launch it in my editor knowing that the path has been set.

Furthermore, in the command line I was still able to execute php php-cs-fixer fix etc. by changing directory to where php-cs-fixer.phar is located.

@Glavin001
Copy link
Owner

However, I removed the path. It threw me an error "Could not find 'php-cs-fixer'. The program may not be installed."

I think you may still need it manually configured, just using the Executables - PHP-CS-Fixer - Path configuration option instead of PHP - PHP-CS-Fixer Path. Go into Atom's Package settings -> Atom-Beautify -> expand Executables section -> expand PHP-CS-Fixer -> set the Path option. This will accomplish the same this as the old PHP - PHP-CS-Fixer Path option except in the standardized Executables configuration section. Hope that helps!

@9585999
Copy link
Author

9585999 commented Jun 19, 2017

@nicholas-ooi You have an atom installed php-cs-fixer?

@nicholas-ooi
Copy link

I had an atom php-cs-fixer installed long time ago but I had it uninstall immediately after I discovered beautify, which had been using for a couple of months.

@Glavin001 Alright will try it out! and thanks!

@Glavin001
Copy link
Owner

@zesda the version of PHP you are using was unsupported:

2017-06-19T08:53:37.785Z - info: [] Version text: PHP 7.1.0beta3 (cli) (built: Aug 20 2016 09:51:26) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

2017-06-19T08:53:37.785Z - error: [] Error: Version is not valid: 7.1.0beta3

I will improve the version parsing to support 7.1.0beta3 as well. Thanks for your debug.md Gist!

@Glavin001
Copy link
Owner

@johanvanhelden and @kataklys from #1727 :

Please follow the issue template provided. More specifically, adding a link to the required debug.md Gist which includes debugging information that answers our most commonly asked questions.
Thank you.

Hopefully the fix for @zesda will work for you, however without each of your debug.md Gist links I can do nothing to fix your problem for certain.

@Glavin001
Copy link
Owner

Published fixes to v0.30.2

@johanvanhelden
Copy link

@Glavin001 6db34cd fixed it for me, thanks!

kumekay added a commit to kumekay/atom-beautify that referenced this issue Jun 20, 2017
* master: (79 commits)
  Update changelog [skip ci]
  Prepare 0.30.2 release
  Fixes Glavin001#1030. Add support for alpha versions of autopep8
  Fixes Glavin001#1725. Fix version parsing of PHP executable
  Fixes Glavin001#1730. Correctly parse PHPCBF version and improve handling of Executable
  See Glavin001#1708. Re-generate documentation for Fortran file extension changes
  Prepare 0.30.1 release
  Prepare changelog for v0.30.1
  See Glavin001#1725. Update changelog
  Fixes Glavin001#1725. Improve PHP-CS-Fixer support with handling script path
  Update changelog. See Glavin001#1030.
  Fix Glavin001#1030. Autopep8 Executable did not handle older and newer versions
  Prepare 0.30.0 release
  See Glavin001#1687. Update README, remove note about Executables now that it is supported
  See Glavin001#1687. Update Changelog with info about Executables
  Add Greenkeeper badge
  See Glavin001#1687. Update README docs to include details about Executables and Docker support
  Add more dependencies to next-update and greenkeep ignore list
  See Glavin001#1687. Fix typos in Travis CI config
  See Glavin001#1687. Install Sass-convert and Uncrustify beautifiers via Docker for Linux Travis CI build
  ...

# Conflicts:
#	README.md
@jordan-webdev
Copy link

I'm still confused. I'm on Windows 10 inside of .atom/packages/php-cs-fixer. What file am I looking for here? I can't find any .phar files. There's an .editorconfig file, but then I get Spawn Unknown error. There's a .coffee file in lib, but same issue when I link to that. There's a .php_cs file in the examples folder, and when I run atom beautify I no longer get any error, but it also does not appear to be working.

Stays ugly (white spaces) after running the beautifier.

@Glavin001
Copy link
Owner

I'm on Windows 10 inside of .atom/packages/php-cs-fixer.

@jordan-webdev, it sounds like you're talking about the package https://atom.io/packages/php-cs-fixer not Atom-Beautify. If you are talking about Atom-Beautify then:

Please follow the issue template provided. More specifically, adding a link to the required debug.md Gist which includes debugging information that answers our most commonly asked questions.
Thank you.

@jordan-webdev
Copy link

Yes, I'm talking about php-cs-fixer, but I'm using Atom beautify. I'm trying to update my path like this thread mentions, but I can't seem to find the right value to input in that field.

@Glavin001
Copy link
Owner

The debug.md Gist I mentioned above, which can easily be automatically generated, helps show me where potential problems are. Once you have provided it we can discuss further.

@Glavin001
Copy link
Owner

Also take a look at the Beautifiers section in the README: https://github.com/Glavin001/atom-beautify#beautifiers
The row for PHP-CS-Fixer provides installation instructions, if you have not already seen.

@jordan-webdev
Copy link

Okay, I installed the .phar file from there now and linked to it in the path. Now when I run atom beautify, there is no error, but it does not work. Notice how there is no space between the opening php tag and the if statement in "if (is_front_page()"? I tried closing and reopening atom editor.

https://gist.github.com/jordan-webdev/6938bb592335c379c99ecf5328904762

@Glavin001
Copy link
Owner

Your logs show:

2017-06-21T14:47:19.319Z - debug: [] spawn C:\Program Files (x86)\iis express\PHP\v7.1\php.EXE 0=C:\Users\LPAS00007316\.atom\packages\php-cs-fixer\php-cs-fixer-v2.phar, 1=fix, 2=--allow-risky=no, 3=--using-cache=no, 4=C:\Users\LPAS00~1\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php
2017-06-21T14:47:19.554Z - debug: [] spawn done 0 Loaded config default.

Files that were not fixed due to errors reported during linting before fixing:
   1) C:\Users\LPAS00007316\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php
 
Fixed all files in 0.006 seconds, 6.000 MB memory used

2017-06-21T14:47:19.554Z - verbose: [] spawn result, returnCode 0
2017-06-21T14:47:19.554Z - verbose: [] spawn result, stdout 
Fixed all files in 0.006 seconds, 6.000 MB memory used

2017-06-21T14:47:19.554Z - verbose: [] spawn result, stderr Loaded config default.

Files that were not fixed due to errors reported during linting before fixing:
   1) C:\Users\LPAS00007316\AppData\Local\Temp\temp117521-9592-pzwhbi.3bibhme7b9.php

Looks like a linting error in your code prevented PHP-CS-Fixer form working. If you have questions I recommend you ask them at https://github.com/FriendsOfPHP/PHP-CS-Fixer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants