NPM安装在MAC上无法执行Python。

26 浏览
0 Comments

NPM安装在MAC上无法执行Python。

我是MAC的新手(OSX版是High Sierra 10.13.3)。我使用来自python.org的安装程序安装了Python 3.6.5,也尝试通过运行brew install python使用brew进行安装。现在,我正在尝试在一个Angular项目中运行sudo npm install,但是我遇到了以下错误:

gyp verb check python checking for Python executable "/path/to/python3/python" in the PATH
gyp verb `which` failed Error: not found: /path/to/python3/python
gyp ERR! stack Error: Can't find Python executable "/path/to/python3/python", you can set the PYTHON env variable.

我尝试了以下所有答案:

Mac OS X上的Python位置

找不到Python可执行文件\"python\"

在我的项目文件夹中,我进行以下操作:

当我输入\'which python\',我得到:

/usr/local/opt/python/libexec/bin/python

当我输入\'which python3.6.5\',我得到:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6

admin 更改状态以发布 2023年5月23日
0
0 Comments

看起来我的node_modules文件夹出了问题。我删除了仓库,重新克隆,然后就好了。

0
0 Comments

对我来说,这一切都是因为nodejs版本导致的。
\nNode版本16以上不支持 \"node-sass\": \"^4.14.1\",因此我必须安装nvm并在MacBook中将nodesjs降级,具体如下:
\n

    \n

  • 在安装nvm之前,请在终端中运行此命令:touch ~/.bash_profile
  • \n

  • 之后,在终端中运行此命令:curl -o-
    \nhttps://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh |\nbash
  • \n

  • 重要提示:不要忘记重启终端或使用命令source ~/.nvm/nvm.sh(这将刷新系统路径中可用的命令)。
  • \n

  • 在终端中使用命令nvm --version,您应该可以看到版本号。
  • \n

  • 使用命令nvm install 14.17.0
  • \n

0