目录

使用npm-install出现check-python-checking-for-Python-executable-python2-in-the-PATH

目录

使用npm install出现check python checking for Python executable “python2“ in the PATH

  • 使用npm install出现check python checking for Python executable “python2” in the PATH时,表示你本地的环境需要使用python2.7的,这个时候可以使用

  • npm install –global windows-build-tools

  • 进行下载, !!!记住因为环境是在c盘下的,使用得用管理员的cmd,

  • https://i-blog.csdnimg.cn/blog_migrate/301a72f1671fcaef2da5249090dad0c5.png

  • 但是在执行的时候会卡住,

    在下面这段代码卡住:

    reify:ajv: timing reifyNode:node_modules/windows-build-tools Completed in 17

  • 通过网上查找需要将npm降级,输入npm install @6 -g

    https://i-blog.csdnimg.cn/blog_migrate/f12fff2bb90e43e364d3bfccc0c45e8f.png

  • 重新输入

  • npm install –global windows-build-tools

  • 下载成功

  • https://i-blog.csdnimg.cn/blog_migrate/0b7a4113b7d7f786242481548497ea1f.png

  • !!!记得重新电脑,之后去的项目把node_modules删除,重新下载npm。下面这个是原话,希望能帮助到大家。

https://i-blog.csdnimg.cn/blog_migrate/5304dc2d737ad86647b59a511f1990a9.png


  • 如果还是有问题可以试试下面的方法:
  • 先使用 npm config get python 看一下当前的python的设置,可以发现不是2.7的版本。
  • 先去下载python2.7的版本到你的电脑中,我这里推荐使用pyenv进行下载。
  • https://i-blog.csdnimg.cn/blog_migrate/13b709d1dde16374abf15d25ea3a123a.png
  • 找到pyenv的python的安装目录:在pyenv下的 /pyenv-win-master\pyenv-win\versions\2.7.15

https://i-blog.csdnimg.cn/blog_migrate/be2dd8d34cb869310bcca228432002c1.png

  • 复制完整目录,最后是以python结尾的。我的是 E:\2.1-software2.0\pyenv\pyenv-win-master\pyenv-win\versions\2.7.15\python。

  • 最后设置一下npm的config为上面的目录

    https://i-blog.csdnimg.cn/blog_migrate/f70618ce3056d6df41f5f37f6b45bd6f.png

  • 重新执行npm install