【问题标题】:How do I make npm install work when it can't find my python installation?当找不到我的 python 安装时,如何使 npm install 工作?
【发布时间】:2020-08-30 09:48:28
【问题描述】:

npm install 失败,我的目标是让它成功。

我安装了 Python 2,但它位于 /usr/bin/python2 而不是 /usr/local/bin/python2

我在运行npm install 时收到以下错误消息。

gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@14.2.0 | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "/usr/local/bin/python2" in the PATH
gyp verb `which` failed Error: not found: /usr/local/bin/python2

我该怎么办?

【问题讨论】:

    标签: node.js macos python-2.7 npm npm-install


    【解决方案1】:

    您可以尝试的最简单的事情之一是从python2 可执行文件的实际位置到npm 期望它的位置的符号链接。

    # create symlink
    ln -s /usr/bin/python2 /usr/local/bin/python2
    
    # test executability of symlink
    /usr/local/bin/python2 --version
    

    创建该符号链接后,在您的项目中重试 npm install

    【讨论】:

      猜你喜欢
      • 2021-09-27
      • 2019-06-26
      • 2022-01-05
      • 1970-01-01
      • 2021-02-15
      • 1970-01-01
      • 2018-03-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多