参考:
- https://help.github.com/en/packages
- Creating a personal access token for the command line
- Configuring npm for use with GitHub Packages
github -> settings -> developer settings -> Personal access tokens -> Generate new token
$ npm login --registry=https://npm.pkg.github.com
> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS会自动在全局 ~/.npmrc 生成一个配置
//npm.pkg.github.com/:_authToken=20d843349550ea259xxxxxx项目下增加 .npmrc 文件 配置 scope registry
@OWNER:registry=https://npm.pkg.github.com/OWNER
always-auth=truepackage.json 中就可以安装使用私有包
{
"dependencies": {
"@OWNER/comp-searchlist": "^1.1.4"
}
}