最近换了 m1 的电脑,在鼓捣 hexo 的时候踩了一些坑。主要涉及到 m1 arm 架构的适配、高版本默认不安装 python2 导致旧项目缺少以来无法运行、高版本 npm 和 不维护项目的适配冲突等。

遇到的错误

  1. 没有 python
    1
    check python checking for Python executable "python" in the PATH
  2. 软连接 python 到 python3,需要安装 mac xcode dev – 思路错误
  3. 软连接 python3 后安装依旧报错
    1
    npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python3 -c import sys; print "%s.%s.%s" % sys.version_info[:3];
  4. 定位到是之前使用的主题安装依赖的问题

参见 node-sass 新解法 ,发现除了这个还有 npm 的大坑,最终找到正确解法

1
npm install hexo-renderer-sass-next --save

完美解决。