gyp ERR! stack Error: Can't find Python executable 'python'

gyp ERR! stack Error: Can't find Python executable 'python'

系统: Win10

Gatsby使用一个Starter[1]进行npm install的时候出现问题:

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack     at failNoPython (G:\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:101:14)
gyp ERR! stack     at G:\nodejs\node_modules\npm\node_modules\node-gyp\lib\confi
gure.js:64:11
gyp ERR! stack     at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "G:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Windows\system32\node_modules\caress-server\node_modules\buffert
ools
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! buffertools@2.0.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buffertools@2.0.1 install script.
npm ERR! This is most likely a problem with the buffertools package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls buffertools
npm ERR! There is likely additional logging output above.

Root Cause

Some npm plugins need node-gyp to be installed.

However, node-gyp has it's own dependencies

反正就是一系列的组件没安装呗.

注意: 这玩意不支持Python 3.0, 因此只能安装2.7

Solution Step 1

Stackoverflow找到的第一个答案[2]:

管理员执行:

$ npm install --global --production windows-build-tools

然后执行:

$ npm install --global node-gyp

Solution Step 2

然鹅上面的Solution似乎对我的电脑无用啊...

可能需要手动设置[3]

npm config set python python2.7
npm config set msvs_version 2015

我不确定这样的设置是否会影响到runtime, 因此我顺手再设置了一个环境变量

PYTHON = C:\Users\Zill.windows-build-tools\python27\python.exe

注意这儿需要详细到文件名

然后就解决了

 

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值