无法在 mac 终端上安装 npm /react /node js

Pxa*_*aml 6 node.js npm azure-devops

我无法在我的 mac 终端或 VSTS 代码上运行 npm install。请参阅下面尝试运行的命令

  1. npm install -g vsts-npm-auth --registry https://registry.npmjs.com--always-auth false
  2. vsts-npm-auth-config .npmrc

这里有错误

我的第二个命令有格式错误

vsts-npm-auth -config .npmrc zsh: exec format error: vsts-npm-auth 
Run Code Online (Sandbox Code Playgroud)
  1. 跑步:npm install
  2. 运行 npm start`

正如你所看到的,我什至无法通过第一个命令。

我尝试清除代理分配代理并且我的网络完全正常,我 ping https://registry.npmjs.com并且它工作正常我也这样做了

-npm 配置集注册表https://registry.npmjs.org/

npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.com--always-auth/vsts-npm-auth failed, reason: getaddrinfo ENOTFOUND registry.npmjs.com--always-auth
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'
Run Code Online (Sandbox Code Playgroud)

小智 9

Linux/Mac 不支持vsts-npm-auth 。

来自Azure DevOps 文档/设置客户端的 npmrc

  1. 第一个选项是生成令牌

在您的开发盒/Linux 或 Mac 上设置身份验证

在“项目设置”部分中,选择“其他”

  1. 第二个选项是与平台无关的库

更好的-vsts-npm-auth


Mur*_*nik 2

您在以下内容之前缺少一个空格--always-auth

npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false
# Space was missing here -----------------------------------------^
Run Code Online (Sandbox Code Playgroud)