相关疑难解决方法(0)

包未发布到 npm(不在 npm 注册表中)

我想将我的 git 存储库发布到 npm,以便我可以在其他项目中使用它。但是当我运行npm publish命令时,我收到以下错误:

npm ERR! code E404
npm ERR! 404 Not Found - PUT https://npm.pkg.github.com/vue-toggle-component
npm ERR! 404
npm ERR! 404  'vue-toggle-component@0.1.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.

npm ERR! A complete log of this run …
Run Code Online (Sandbox Code Playgroud)

package node.js npm

20
推荐指数
4
解决办法
2万
查看次数

Github 操作:NPM 发布 404 未找到

在我的 github 项目中,每当有东西被推送到 master 分支时,我都会尝试自动创建一个新版本并将其发布到 NPM。

这个想法

  1. 创建新的次要版本
  2. 将包发布到 NPM

我正在使用 github 操作。我的工作流程文件如下所示:

# This workflow will run tests using node and then publish a package to the npm registry when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
#trigger on every commit to the main branch
  push:
    branches:
      - main
      - master 

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: npm test

  publish-npm:
    needs: build …
Run Code Online (Sandbox Code Playgroud)

continuous-integration npm github-actions building-github-actions

7
推荐指数
2
解决办法
4601
查看次数

运行“npm publish”时出现 404 错误

我正在尝试将包发布到 npm 注册表。但是当我点击命令时,npm publish我收到了这个错误。

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.

> imojha@1.0.0 prepublish .
> npm run build


> imojha@1.0.0 build /home/suraj/Projects/bitandbang
> node build.js

npm notice 
npm notice   imojha@1.0.0
npm notice === Tarball Contents === 
npm notice 1.1kB LICENSE     
npm notice 3.6kB bin/output  
npm notice 233B  bin/card.js …
Run Code Online (Sandbox Code Playgroud)

javascript node.js npm npm-publish

7
推荐指数
1
解决办法
2637
查看次数

在 Github Action 中如何引用私有包进行测试?

我已经为 Github Action 编写了一个测试文件:

测试.yml

name: Test
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x, 16.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - run: npm ci
      - run: npm run build --if-present
      - run: npm test
Run Code Online (Sandbox Code Playgroud)

但我的package.json使用组织私有存储库。当 Github Action 运行时,它失败并出现错误:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@org/repo/
npm ERR! 404 
npm ERR! 404  '@org/repo@1.2.3' …
Run Code Online (Sandbox Code Playgroud)

testing yaml unit-testing node.js github-actions

5
推荐指数
1
解决办法
2703
查看次数