简体   繁体   English

无法通过 pip 或 npm 安装软件包

[英]Can't install packages via pip or npm

I'm trying to install some packages globally on my Mac.我正在尝试在我的 Mac 上全局安装一些软件包。 But I'm not able to install them via npm or pip , because I'll always get the message that the packages does not exist.但是我无法通过npmpip安装它们,因为我总是会收到包不存在的消息。 For Python , I solved this by always using a virtualenv .对于Python ,我总是使用virtualenv解决了这个问题。 But now I'm trying to install the @vue/cli via npm , but I'm not able to access it.但是现在我正在尝试通过npm安装@vue/cli ,但是我无法访问它。 The commands are working fine, but I'm just not able to access it.这些命令工作正常,但我无法访问它。 I think it has something to do with my $PATH , but I don't know how to fix that.我认为这与我的$PATH ,但我不知道如何解决。

If I look in my Finder, I can find the @vue folder in /users/.../node_modules/ .如果我查看 Finder,我可以在/users/.../node_modules/找到 @vue 文件夹。 Does someone know how I can access this folder with the vue command in Terminal?有人知道如何使用终端中的vue命令访问此文件夹吗?

If it's a PATH problem:如果是PATH问题:

1) Open up Terminal. 1) 打开终端。

2) Run the following command: 2) 运行以下命令:

sudo nano /etc/paths

3) Enter your password, when prompted. 3) 出现提示时输入您的密码。

4) Check if the correct paths exist in the file or not. 4) 检查文件中是否存在正确的路径。

5) Fix, if needed 5)修复,如果需要

6) Hit Control-X to quit. 6) 按 Control-X 退出。

7) Enter “Y” to save the modified buffer. 7) 输入“Y”保存修改后的缓冲区。

Everything, should work fine now.一切,现在应该可以正常工作了。 If it doesn't try re-installing NPM/PIP.如果它不尝试重新安装 NPM/PIP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM