teambit / bit-with-github-actions

A Bit integration with GitHub Actions CI.

Home Page:https://bit.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Registry error with subdirectory

mattborghi opened this issue · comments

Hi, I am trying to install my @bit public components on a project that is in a subfolder (frontend/) but I am getting the following error:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@mattborghi%2fsciquant.ui.github - Not found
npm ERR! 404 
npm ERR! 404  '@mattborghi/sciquant.ui.github@0.0.2' is not in the npm registry.

I tried moving the .npmrc file into the subfolder but the error persists. The yml file that I used is this one

name: Deploy to Github Pages
on: 
  push:
    branches: 
      - 'main'
jobs:
  Deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./frontend
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: '14.x'
      - run: npm install
      - run: npm run deploy

I also tried setting this configuration without using the .npmrc file with no luck like this

- uses: actions/setup-node@v2
        with:
          always-auth: true
          node-version: '14.x'
          registry-url: https://node.bit.dev

I get another error in this case

npm WARN audit Audit result from registry missing metadata. This is probably an issue with the registry.
added 2060 packages from 1143 contributors in 49.193s

147 packages are looking for funding
  run `npm fund` for details

npm ERR! Cannot convert undefined or null to object

Does anyone have any idea why this might be happening? Thanks in advance, Matias.

For reference, I solved the issue without using the .npmrc file and with the script as follows (check here):

name: Deploy to Github Pages
on: 
  push:
    branches: 
      - 'main'
jobs:
  Deploy:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./frontend
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          always-auth: true
      - name: Install and Build 🔧
        run: |
            npm config set '@mattborghi:registry' https://node.bit.dev
            npm config set @bit:registry https://node.bit.dev
            npm install
      - name: Deploy with gh-pages 🚀 # https://github.com/tschaub/gh-pages/pull/368
        run: | # add the git pull... when merging pull requests
          git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
          git pull origin main
          npm run deploy -- -u "github-actions-bot <support+actions@github.com>"
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I added these lines for installing bit and my custom components (as shown here)

 npm config set '@mattborghi:registry' https://node.bit.dev
 npm config set @bit:registry https://node.bit.dev

Then I followed some guidelines from the github documentation in order to deploy to github pages using gh-pages.