简体   繁体   English

从私有 github 存储库安装 npm 包 npm ERR! 代码ENOENT

[英]install npm package from private github repository npm ERR! code ENOENT

i'm trying to install a npm package from private repository github of my organisaion with npm install, but i still have a npm ERR! code ENOENT我正在尝试使用 npm install 从我的组织的私有存储库 github 安装一个 npm 包,但我仍然有一个npm ERR! code ENOENT npm ERR! code ENOENT How can i configure my npmrc to say that i would install package from a private github repository + npm package public repository ? npm ERR! code ENOENT我如何配置我的 npmrc 以说我将从私有 github 存储库 + npm 包公共存储库安装包?

You need Authorize your GitHub personal access token and ensure it has the repo and read:packages scopes enabled.您需要授权您的GitHub 个人访问令牌,并确保它启用了 repo 和read:packages范围。

echo "export GITHUB_TOKEN=your_github_token" >> ~/.zshrc
source ~/.zshrc

npm config set '//npm.pkg.github.com/:_authToken' "${GITHUB_TOKEN}"

then npm i should pass然后npm i应该通过

As mentioned in previous answers you need to set a personal token within your profile so that when npm runs it will use your token.正如前面的答案中提到的,您需要在您的个人资料中设置一个个人令牌,以便在 npm 运行时它会使用您的令牌。

Another option is, you can ignore the file .npmrc where you'll add your token.另一种选择是,您可以忽略将在其中添加令牌的文件.npmrc

registry = https://npm.pkg.github.com/company_package
//npm.pkg.github.com/:_authToken=my_token_here

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

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