2016-10-05 5 views
0

이전에 PHP로 php-cs-fixer를 사용하여 PHP를 아름답게 꾸미기 위해 성공적으로 Atom을 구성했지만 지금은 다른 Mac에서 동일한 프로세스를 수행해야하므로 정확하게 기억할 수 없습니다 내가 어떻게했는지.php-cs-fixer 및 PATH 변수 구성

프런트 엔드 개발자로서 필자는 PHP 전문가는 아니지만 Atom 플러그인은 php-cs-fixer를 사용하여 실제 수정을 용이하게하는 중개자 일 뿐이라는 것을 알고 있습니다. 에 접근 할 수있다. 해결사를 설치 한 후에는 PATH 변수에 위치를 추가해야했습니다. 혼란스러운 부분은 Atom (checked ~/.atom/packages)이나 Homebrew (brew list으로 확인 됨)를 통해 설치된 픽스쳐가 없다는 것입니다. 그러나 파일은/usr/local/bin에 있습니다.

See https://github.com/FriendsOfPHP/PHP-CS-Fixer for program installation instructions. 
Your program is properly installed if running 'which php-cs-fixer' in your Terminal returns an absolute path to the executable. If this does not work then you have not installed the program correctly and so Atom Beautify will not find the program. Atom Beautify requires that the program be found in your PATH environment variable. 
Note that this is not an Atom Beautify issue if beautification does not work and the above command also does not work: this is expected behaviour, since you have not properly installed your program. Please properly setup the program and search through existing Atom Beautify issues before creating a new issue. See https://github.com/Glavin001/atom-beautify/search?q=php-cs-fixer&type=Issues for related Issues and https://github.com/Glavin001/atom-beautify/tree/master/docs for documentation. If you are still unable to resolve this issue on your own then please create a new issue and ask for help. 
Hide Stack Trace 
Error: Could not find 'php-cs-fixer'. The program may not be installed. 
    at PHPCSFixer.module.exports.Beautifier.commandNotFoundError (/Users/ourcore/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:204:14) 
    at /Users/ourcore/.atom/packages/atom-beautify/src/beautifiers/beautifier.coffee:304:22 
    at tryCatcher (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/util.js:16:23) 
    at Promise._settlePromiseFromHandler (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:510:31) 
    at Promise._settlePromise (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:567:18) 
    at Promise._settlePromise0 (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:612:10) 
    at Promise._settlePromises (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/promise.js:687:18) 
    at Async._drainQueue (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:138:16) 
    at Async._drainQueues (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:148:10) 
    at Async.drainQueues (/Users/ourcore/.atom/packages/atom-beautify/node_modules/bluebird/js/release/async.js:17:14) 
    at process._tickCallback (internal/process/next_tick.js:103:7) 

which php-cs-fixer 반환 /usr/local/bin/php-cs-fixerPATH 변수는 현재 /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/ourcore/.atom/packages/php-cs-fixer를 포함 : 나는 그것을 이동하는 경우, 아톰은 그래서 확실히이 파일을 사용하고, 원래의 오류를 반환합니다.

내 질문에, PATH 변수가 다른 위치에서 변수를 가리키는 것처럼 보이면 해결사는 어떻게 작동하며 어떻게 끝났습니까? 내 PATH의 위치가 중요합니까? 아니면 Atom 플러그인이/usr/local/bin을 볼 수 있습니까? 난 그냥 반복하기 전에 전체 과정을 완전히 이해하고 싶다.

편집 : 더 이상 테스트 할 때 내 PATH에서 Atom 디렉토리를 제거 했으므로 플러그인에 영향을 미치지 않았으므로 파일을 두 번째 Mac에 같은 디렉토리에 복사하면 아무런 문제없이 실행할 수있었습니다. PATH을 수정하십시오. 해결사가 누군가 OS를 알려주지 않습니까?

+0

당신이 당신의 [설정]에서'executablePath'를 지정 했는 모든 잘해야 그 후 https://github.com/FriendsOfPHP/PHP-CS-Fixer

머리와 https://github.com/pfefferle/ (거기에서 다운로드 및 설치 단계를 수행 원자 - PHP - CFS - 해결사 # 설정)? 그것 없이는 * 작동해야하지만 시도해 볼 가치가 있습니다. – idleberg

+0

내가 가고 나서 공백으로되어있어서/usr/local/bin을 어떻게 보는지 궁금합니다. –

+0

이 설정은 기본 버전을 덮어 쓰도록 설정되었으므로 비워두면'PATH'에서 찾은 것을 사용합니다 ([see source] (https://github.com/pfefferle/atom-php-cs-fixer/blob /v2.5.9/lib/php-cs-fixer.coffee#L17)) – idleberg

답변

0

먼저 "which php-cs-fixer"또는 "php-cs-fixer"(실행중인 OS에 따라 다름)를 확인하고 터미널에 아무 것도 반환되지 않으면 실제로 설치를 수동으로 설치하는 것이 가장 좋습니다.

+0

이 대답은 링크의 정보를 통합하면 도움이됩니다. 링크가 끊어지면 답안에 포함시키지 않는 한 해당 정보가 많이 표시됩니다. –

+0

@Frank 링크가 만료 될 수 있으므로 답변을 개선하십시오. –