簡體   English   中英

當找不到我的 python 安裝時,如何使 npm 安裝工作?

[英]How do I make npm install work when it can't find my python installation?

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

我該怎么辦?

您可以嘗試的最簡單的事情之一是從python2可執行文件的實際位置到npm期望它的位置的符號鏈接。

# create symlink
ln -s /usr/bin/python2 /usr/local/bin/python2

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

創建該符號鏈接后,在項目中重試npm install

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM