gpt4 book ai didi

github - 从 Github Actions 将 NPM 模块发布到 github 包注册表?

转载 作者:行者123 更新时间:2023-12-05 02:10:15 25 4
gpt4 key购买 nike

到目前为止,我的 YML 一直在根据其他 stackoverflow 线程 + 文档添加位:

name: Node install, build and test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Create NPMRC
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
- name: Publish to Github Packages
run: |
npm config set _auth $NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}

在我的 package.json 中我有:

  "publishConfig": {
"registry": "https://npm.pkg.github.com/"
},

通过上面的配置,我不断得到

E400 Bad Request
Your request could not be authenticated by the Github Pacakges service. Please ensure your access token is valid and has the appropriate scopes configured.

最佳答案

您正在将错误的内容写入 ~/.npmrc 文件。

它应该是 //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }} 但是你在做 //registry.npmjs.org/: _authToken=${{ secrets.GITHUB_TOKEN }}

关于github - 从 Github Actions 将 NPM 模块发布到 github 包注册表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58938153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com