簡體   English   中英

Sublime Text 3的PHPCS插件提供了WinError 2

[英]PHPCS Plugin for Sublime Text 3 gives WinError 2

我為Sublime Text 3安裝了PHPCS插件,並按如下所示設置了用戶配置文件:

{

// Path to php on windows installation
// This is needed as we cannot run phars on windows, so we run it through php
"phpcs_php_prefix_path": "C:\\wamp\bin\\php\\php5.4.12\\php.exe",

// This is the path to the bat file when we installed PHP_CodeSniffer
"phpcs_executable_path": "C:\\wamp\\bin\\php\\php5.4.12\\phpcs.bat",

// PHP-CS-Fixer settings
// Don't want to auto fix issue with php-cs-fixer
"php_cs_fixer_on_save": false,

// Show the quick panel
"php_cs_fixer_show_quick_panel": true,

// The fixer phar file is stored here:
"php_cs_fixer_executable_path": "C:\\wamp\bin\\php\\php5.4.12\\php-cs-fixer.phar",

// PHP Linter settings
// Yes, lets lint the files
"phpcs_linter_run": true,

// And execute that on each file when saved (php only as per extensions_to_execute)
"phpcs_linter_command_on_save": true,

// Path to php
"phpcs_php_path": "C:\\wamp\bin\\php\\php5.4.12\\php.exe",

// This is the regex format of the errors
"phpcs_linter_regex": "(?P<message>.*) on line (?P<line>\\d+)",


// PHP Mess Detector settings
// Not turning on the mess detector here
"phpmd_run": false,
"phpmd_command_on_save": false,
"phpmd_executable_path": "",
"phpmd_additional_args": {}
}

當我嘗試嗅探PHP文件時,出現以下錯誤:“ FileNotFoundError:[WinError 2]系統找不到指定的文件”

我已經仔細檢查了我的路徑,它們是正確的,是否Sublime僅讀取默認配置文件而不是用戶配置文件?

編輯-我的路徑缺少第二個反斜線,對不起,嗅探器現在正在工作。

我嘗試不閱讀任何說明,但找到了解決方案。 請嘗試以下步驟:

  • 通過ST3中的Package Control下載php代碼嗅探器插件。
  • 從此網站下載php-cs-fixer文件=> cs.sensiolabs.org/(直接鏈接=> cs.sensiolabs.org/get/php-cs-fixer.phar)
  • 將下載的文件復制到您的php.exe目錄(我的文件是C:/XAMMP/php/php.exe)
  • 從此頁面下載PHP_CodeSniffer PEAR代碼包pear.php.net/package/PHP_CodeSniffer/download/All(直接鏈接=> http://download.pear.php.net/package/PHP_CodeSniffer-1.5.0RC4.tgz
  • 找到PHP_CodeSniffer-1.5.0RC4.tgz \\ PHP_CodeSniffer-1.5.0RC4 \\ scripts \\ phpcs.bat並復制此文件(在php.exe目錄中)
  • 復制第一篇文章的配置文件,並在“程序包設置”->“ PHP嗅探器”->“設置”-“用戶文件”中進行寫入時相應地更改目錄。 此方法在Win8 x64系統中的Sublime Text 3 Build 3047上對我有用...對我而言,不再慢的ST2 ...干杯

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM