无法将包裹推到Github

问题描述

我正在尝试为NPM项目设置Github软件包,但是遇到了一些问题。

我在某个特定的组织下有一个仓库: my-orgname/my-repo-name 这个仓库是私人的

my-orgname/my-repo-name存储库中的代码包含一个NPM模块。

项目中的package.json

{
  "name": "@my-orgname/my-repo-name","version": "1.0.0","description": ".....","publishConfig": {
    "registry": "https://npm.pkg.github.com/"
  },"repository": {
    "type": "git","url": "https://github.com/my-orgname/my-repo-name"
  },.....

.npmrc在项目文件夹中 registry=https://npm.pkg.github.com/my-orgname

〜/ .npmrc文件

//registry.npmjs.org/:_authToken=<TOKEN>
//npm.pkg.github.com/:_authToken=<TOKEN>

在项目文件夹中。 npm publish

结果

npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/@my-orgname%2fmy-repo-name - The expected resource was not found.
npm ERR! 404 
npm ERR! 404  '@my-orgname/my-repo-name@1.0.0' 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 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball,folder,http url,or git url.

解决方法

我遇到了类似的问题,发现我需要给我的 github 个人访问令牌以下权限:

  • repo(完全控制私有仓库)
  • write:packages(将包上传到 github 包注册表)
  • read:packages(从 gi​​thub 包注册表下载包)

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...