【问题标题】:npm package published via github not appearing in npm module search通过 github 发布的 npm 包未出现在 npm 模块搜索中
【发布时间】:2020-08-17 15:45:29
【问题描述】:

我通过 Github 的包管理器发布了一个包,它似乎可以工作。它出现在repo's web pagemy profile page 上。当我跑步时

npm install @franklinharvey/time-remaining@1.0.0

在本地它可以工作,但是当我在 Replit 或 CodeSandbox 等新环境中尝试它时,它不会出现。它也没有出现在npmjs.com

这里有一些配置文件

.npmrc

registry=https://npm.pkg.github.com/franklinharvey

.yarnrc

"@franklinharvey:time-remaining" "https://npm.pkg.github.com"

package.json(部分)

"name": "@franklinharvey/time-remaining",
"publishConfig": {
    "registry": "https://npm.pkg.github.com"
},
"repository": {
    "url": "git@github.com:franklinharvey/time-remaining.git"
}

.npmignore

.gitignore
src/
*.log
*.tsbuildinfo

package-lock.json
yarn.lock

coverage
node_modules

【问题讨论】:

  • 这里有同样的问题。
  • 你解决了这个问题吗?我也遇到了同样的问题。

标签: npm github-package-registry


【解决方案1】:

我们公司还通过 github 发布其 npm 包。你的帖子给了我一个想法,它解决了我们的问题。

简而言之,我认为您需要一个更完整的.npmrc,您在尝试下载包但没有成功(包含如下注册表信息);如果您的包是私有的,也可以发送npm login

我的.npmrc

@my-company-s-npm-account:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=[GITHUB_AUTH_TOKEN_HERE_WITHOUT_BRACKETS]
registry=https://registry.npmjs.org/

希望这能解决您的问题。

如果您无法在尝试安装的位置添加.npmrcnpm login,并且您的包是私有的,我不知道如何提供帮助。

【讨论】:

    猜你喜欢
    • 2015-01-05
    • 2022-06-22
    • 2021-01-01
    • 2023-03-18
    • 1970-01-01
    • 2015-12-09
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多