每当我在 vscode 或我的 cmd(我使用的是 Windows 10)中连接到 VPN(在我的例子中是 psiphon)时尝试从 npm(或 YARN)下载任何包时,它似乎都不起作用,过了一会儿它就不起作用了。抛出这样的错误
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.com/nodemon failed, reason: getaddrinfo ENOTFOUND 28
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'`
I
但是
如果我断开与VPN的连接,一切都会正常工作😓。 而且我确实需要连接到 VPN。
如有任何建议,我们将不胜感激。 预先感谢🥺
如果您已经用尽所有常见解决方案,请尝试 Windows 等效解决方案:
export NODE_OPTIONS=--dns-result-order=ipv4first