博主在mac上使用spacemacs安装php时报错php layer error while installing php-extras: wrong-type arguement stringp nil

php-extras作者arnestedissue: Php-extras error: wrong-type arguement stringp nil 中解释说

Reading through some of the referenced issues suggests the problem is unrelated to php-extras and that a missing tar executable is the root cause

即错误的原因并不在于包本身,而是系统上没有tar可执行文件所致

一切明了,解决方法如下:

  1. 安装tar

    brew install gnu-tar --with-default-names

    当出现如下字样即表示安装成功(过程可能会有点久)

    ==> Downloading https://ftp.gnu.org/gnu/tar/tar-1.30.tar.gz
    Already downloaded: /Users/fidding/Library/Caches/Homebrew/downloads/xxxxxxxx0d3c61caxxxxxx8a84a3d5bc87915e2bdd8xxxxxxxxxxxx--tar-1.30.tar.gz
    ==> ./configure --prefix=/usr/local/Cellar/gnu-tar/1.30 --mandir=/usr/local/Cellar/gnu-tar/1.30/s
    
    ==> make install
    /usr/local/Cellar/gnu-tar/1.30: 13 files, 1.7MB, built in 2 minutes 49 seconds

    这里有个目录第二步需要用到,即/usr/local/Cellar/gnu-tar/1.30

  2. 配置.spacemacs文件,在dotspacemacs/user-init ()底下设置quelpa-build-tar-executable执行文件,代码如下:

    ;; 文件位置为第一步最后的执行目录下的bin/tar
    (defun dotspacemacs/user-init ()
     (setq-default quelpa-build-tar-executable "/usr/local/Cellar/gnu-tar/1.30/bin/tar")
     )
  3. 重启emacs大功告成

happy coding!