【发布时间】:2020-05-19 03:52:04
【问题描述】:
我在使用 node-gyp 包时遇到了一些问题,我相信这是因为我需要使用 python 2.7 而不是 python 3。
我已经设置了我的 PATH 环境变量,所以当我执行 python --version 时,输出是 Python 2.7.16。
但是,在同一个终端中,当我转到 yarn 时,安装我的项目。它失败了,我可以看到日志的输出是:
Command: node-gyp rebuild
Arguments:
Directory: /Users/myname/Documents/myproject
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@12.14.0 | darwin | x64
gyp info find Python using Python version 3.7.3 found at "/Users/myname/anaconda3/bin/python"
我也在使用 nvm。卡塔利娜 10.15.2。节点 12.14.0。 NVM 0.33.11。
为什么我的终端版本显示我使用 2.7,但日志显示命令 node-gyp rebuild 使用 3.7.3?如果我已经设置了我的环境变量,我可以改变什么来纠正这个问题?和nvm有关吗?
【问题讨论】: