Mac nvm install failed python: not found

在MacVentura13.2,特别是M2芯片的设备上,由于缺少python导致nvm安装失败。解决方案包括启用Terminal的Rosetta翻译,并通过修改shell配置文件将python3作为python的别名。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Mac nvm install failed python: not found

问题

环境
Mac,Ventura 13.2,M2。

安装出现错误

$>./configure --prefix=/Users/xxx/.nvm/versions/node/v12.22.12 <
./configure: line 3: exec: python: not found
nvm: install v12.22.12 failed!

解决方法

到 App 文件夹,并且打开

cd /System/Applications/Utilities/
open .

找到 终端.app,右键 -> 显示简介,钩上 Rosetta

在这里插入图片描述

记得改完 Rosetta 之后,要重启 终端.app,完全退出,然后再打开 终端.app

python3 命名 python

echo "alias python=/usr/bin/python3" >> ~/.zshrc
source ~/.zshrc
echo "alias python=/usr/bin/python3" >> ~/.bash_profile
source ~/.bash_profile

这样就可以下载了

npm error code 1 npm error path D:\springboot-vue-example-master\server_frontend\node_modules\node-sass npm error command failed npm error command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js npm error Building: D:\node\node.exe D:\springboot-vue-example-master\server_frontend\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library= npm error gyp info it worked if it ends with ok npm error gyp verb cli [ npm error gyp verb cli 'D:\\node\\node.exe', npm error gyp verb cli 'D:\\springboot-vue-example-master\\server_frontend\\node_modules\\node-gyp\\bin\\node-gyp.js', npm error gyp verb cli 'rebuild', npm error gyp verb cli '--verbose', npm error gyp verb cli '--libsass_ext=', npm error gyp verb cli '--libsass_cflags=', npm error gyp verb cli '--libsass_ldflags=', npm error gyp verb cli '--libsass_library=' npm error gyp verb cli ] npm error gyp info using node-gyp@3.8.0 npm error gyp info using node@22.14.0 | win32 | x64 npm error gyp verb command rebuild [] npm error gyp verb command clean [] npm error gyp verb clean removing "build" directory npm error gyp verb command configure [] npm error gyp verb check python checking for Python executable "python2" in the PATH npm error gyp verb `which` failed Error: not found: python2 npm error gyp verb `which` failed at getNotFoundError (D:\springboot-vue-example-master\server_frontend\node_modules\which\which.js:13:12) npm error gyp verb `which` failed at F (D:\springboot-vue-example-master\server_frontend\node_modules\which\which.js:68:19) npm error gyp verb `which` failed at E (D:\springboot-vue-example-master\server_frontend\node_modules\which\which.js:80:29) npm error gyp verb `which` failed at D:\springboot-vue-example-master\server_frontend\node_modules\which\which.js:89:16 npm error gyp verb `which` failed at D:\springboot-vue-example-master\server_frontend\node_modules\isexe\index.js:42:5 npm error
03-12
error D:\project\eam-web\node_modules\deasync: Command failed. Exit code: 1 Command: node ./build.js Arguments: Directory: D:\project\eam-web\node_modules\deasync Output: D:\project\eam-web\node_modules\deasync>if not defined npm_config_node_gyp (node "C:\nvm4w\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild ) gyp info it worked if it ends with ok gyp info using node-gyp@9.1.0 gyp info using node@16.20.2 | win32 | x64 gyp info find Python using Python version 3.8.0 found at "D:\Programs\Python\Python38\python.exe" gyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the "Desktop development with C++" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** gyp ERR! find VS gyp ERR! configure error gyp ERR! stack Error: Could not find any Visual Studio installation to use gyp ERR! stack at VisualStudioFinder.fail (C:\Users\GIENTECH\AppData\Local\nvm\v16.20.2\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47) gyp ERR! stack at C:\Users\GIENTECH\AppData\Local\nvm\v16.20.2\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16 gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\GIENTECH\AppDa
03-27
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值