【问题标题】:PHPCS Plugin for Sublime Text 3 gives WinError 2Sublime Text 3 的 PHPCS 插件提供 WinError 2
【发布时间】:2013-09-26 01:56:20
【问题描述】:

我为 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 是否可能只读取默认配置文件而不是用户配置文件?

编辑 - 我的路径缺少第二个反斜杠,我很抱歉,嗅探器现在正在工作。

【问题讨论】:

    标签: php sublimetext3


    【解决方案1】:

    我尝试过不阅读任何说明,但我找到了解决方案。请尝试以下步骤:

    • 通过 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)
    • 从此页面pear.php.net/package/PHP_CodeSniffer/download/All下载PHP_CodeSniffer PEAR代码包(直接 链接 => 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...... 干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-13
      • 2014-03-31
      • 2018-11-16
      • 1970-01-01
      • 1970-01-01
      • 2014-10-11
      • 2013-02-17
      相关资源
      最近更新 更多