node.js - 在 Github Action 中,如何将私有包发布到使用私有依赖项的 NPM?
问题描述
试图在 Github 组织中了解如何使用私有组织的依赖项并使用 Github Action 发布另一个私有包,但它在 Actions 中出错:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@wilson%monday - Not found
npm ERR! 404
npm ERR! 404 '@wilson/monday@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'tuesday'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
我的npm.yml文件:
name: npm
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm ci --ignore-scripts
- run: npm run build --if-present
- run: npm publish
env:
CI: true
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
我也尝试更改registry-url
为:
registry-url: 'https://npm.pkg.github.com'
包.json:
"name": "@wilson/tuesday",
"version": "1.3.7"
"publishConfig": {
"access": "restricted",
"registry": "https://npm.pkg.github.com/wilson/"
},
"dependencies": {
"@wilson/monday": "latest",
},
我能找到与此相关的最接近的问题:“如何在私有组织仓库中发布带有 github 操作的私有 github 包? ”。
基于这个答案,我假设我的存储库中不需要 .npmrc 。
关于该主题的进一步研究:
- 在 Github Actions 上从 package.json 安装私有 github 包
- 尝试发布到包时,Github Actions 工作流(私人仓库)挂起
- 如何使用 github 操作中的令牌从私有 git 存储库安装 npm pckage
- Github 操作,使用 npm 或 yarn 安装 Github 包时出现 401 未授权
在我的 Github Action 中,如何将私有包发布到使用私有依赖项的 NPM?
解决方案
推荐阅读
- javascript - 如何在加载时检查 JavaScript 时间
- python - csv中的数据,双引号括起来的数据
- python - Python中spdiags的排名问题
- flutter - 如何缓存 Future 返回的值?
- r - 对数据集进行子集以保留最大的 2 个值
- php - 访问数组的名称值
- azure - 如何使用 azurerm_virtual_machine_scale_set_extension 中的设置
- google-sheets - Google 表格乘以百分比
- sql - 标量子查询使用 UNNEST 生成多个元素
- reactjs - 样式化组件:babel-plugin-styled-components 不起作用