npm config set registry https://registry.npmmirror.com/设置完代理之后为什么npm config get proxy还返回false
时间: 2023-12-12 07:02:17 浏览: 1086
设置 registry 并不会自动设置代理。在你执行 `npm config set registry https://registry.npmmirror.com/` 之后,如果你想设置代理,你需要执行类似的命令来设置代理。
你可以尝试执行以下命令来设置代理:
```
npm config set proxy http://your-proxy-server:your-proxy-port
npm config set https-proxy http://your-proxy-server:your-proxy-port
```
将 `your-proxy-server` 替换为你的代理服务器地址,将 `your-proxy-port` 替换为代理服务器端口号。
执行完这两个命令后,再次运行 `npm config get proxy` 应该会返回你设置的代理值。
相关问题
npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npm.taobao.org/@vue%2fcli failed, reason: getaddrinfo ENOTFOUND proxy-server npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! Log files were not written due to an error writing to the directory: E:\Program Files\node.js\node_cache\_logs npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal C:\Users\lhq>npm config set registry http://registry.cnpmjs.org/ C:\Users\lhq>npm install -g @vue/cli npm ERR! code ENOTFOUND npm ERR! syscall getaddrinfo npm ERR! errno ENOTFOUND npm ERR! network request to http://registry.cnpmjs.org/@vue%2fcli failed, reason: getaddrinfo ENOTFOUND proxy-server npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! Log files were not written due to an error writing to the directory: E:\Program Files\node.js\node_cache\_logs npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
这个错误提示表明你的网络连接存在问题,可能是由于代理设置不正确或网络设置不正确导致的。你可以尝试以下解决方案:
1. 检查代理设置:如果你使用了代理服务器,请确保代理配置正确。可以使用以下命令检查代理配置:
```
npm config get proxy
npm config get https-proxy
```
如果返回结果为空或不正确,可以使用以下命令进行设置:
```
npm config set proxy http://your-proxy-server:port
npm config set https-proxy http://your-proxy-server:port
```
将 `your-proxy-server` 替换为你的代理服务器地址,`port` 替换为代理服务器的端口号。
2. 检查网络设置:确保你的网络连接正常,并且没有任何网络层面的问题。可以尝试打开其他网页或使用其他网络连接检查。
3. 更换注册表源:你可以尝试切换到其他的 npm 注册表源。在命令行中运行以下命令切换到 cnpmjs 的源:
```
npm config set registry http://registry.cnpmjs.org/
```
然后再次运行安装命令:
```
npm install -g @vue/cli
```
如果还是无法解决问题,可以尝试使用其他的 npm 注册表源,如淘宝源或官方源。
如果以上方法都没有解决问题,可能需要进一步检查你的网络环境和配置。
npm ERR! network request to https://registry.npm.taobao.org/mapboxgl-control-minimap failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings.
这个错误提示是npm在安装mapboxgl-control-minimap时出现的网络连接问题。错误信息显示npm无法找到名为registry.npm.taobao.org的域名,通常是由于网络连接问题造成的。这可能是由于您的网络代理或网络设置不正确所致。您可以尝试检查您的网络设置或尝试使用其他网络连接来解决这个问题。
阅读全文