Bit: Component Not Found: Bit not exporting components correctly

Created on 4 Dec 2019  路  10Comments  路  Source: teambit/bit

When running

bit export

After running

bit tag -all

Now and then Bit throws an error saying one component can not be found. The error looks like this:

error: component "[organisation].[collection]/[name]@[version]"

Now this happens completely randomly but it always seems to happen to the component that has no dependencies itself but other components are dependent on it. Generally, after making changes to a few components running tag all and export everything is fine; however, it seems that now and then Bit messes up and doesn't export the components in the correct order. What I mean is that it tries to export a component that is reliant on another component that was version bumped when normally Bit figures out what order to export them in.

After talking to Bit support it seems there is a bug in Bit, as Bit should be able to create the right order to export components. It seems that there's are some edge case that causes it to break.

Specifications

  • Bit version: 14.6.0
  • Node version: 13.2.0
  • npm / yarn version: 6.13.1
  • Platform: MacOS
  • Bit compiler (include version): [email protected]
  • Bit tester (include version):
areexport prioritcritical typbug

Most helpful comment

ok, exporting with the --all-versions solves this!

All 10 comments

For anyone who has the issue current workaround is to run the following command:

bit export [organisation].[collection] [name-of-component-thats-throwing-the-error]@[the-version-it-cant-find-in-the-error]

Then you can run

bit export

To export all other components

@AlexanderKaran Thanks for reporting this.
I'm looking into it, I'll post my findings here.

Thanks @AlexanderKaran for posting the issue.
It has been fixed in the PR above. You can see the PR to get the details why it happened.
Once this is released, if there are not any cyclic dependencies between the different scopes, Bit will export the dependencies first then the dependents to avoid the error you got.

Hey @davidfirst

I think this issue might not be 100% fixed.

I have come across the same issue again when working with components from different collections the difference this time being my workaround no longer works either.

@AlexanderKaran , I'd like to try to reproduce it.
I'll need two things, please.

  1. the error you got. It includes the component-name that was not found.
  2. run "bit graph" and send me the picture you got. It'll help me understand the relationship between the components. (you can send to my email [email protected]).

Hi David

Sorry for the late reply, been out of the office.

I think the team removed the component and few others then re-added it to get around the issue so I can not run bit graph.

If it happens again I will forward on the details you requested.

Once again sorry for the slow reply.

No worries, please re-open once you're able to reproduce it.

Happening to me right now.
Screen Shot 2020-03-17 at 17 30 53

I can see the component is correctly tagged at the .bitmap:

"concrete/[email protected]": {
  "files": [
      {
          "relativePath": "src/components/concrete/testimonial/index.ts",
          "test": false,
          "name": "index.ts"
      },
      {
          "relativePath": "src/components/concrete/testimonial/testimonial-obj.tsx",
          "test": false,
          "name": "testimonial-obj.tsx"
      },
      {
          "relativePath": "src/components/concrete/testimonial/testimonial.module.scss",
          "test": false,
          "name": "testimonial.module.scss"
      },
      {
          "relativePath": "src/components/concrete/testimonial/testimonial.tsx",
          "test": false,
          "name": "testimonial.tsx"
      }
  ],
  "mainFile": "src/components/concrete/testimonial/index.ts",
  "trackDir": "src/components/concrete/testimonial",
  "origin": "AUTHORED",
  "exported": false
},

What can I do?

ok, exporting with the --all-versions solves this!

Fixed by the commit above and merged into master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rap0so picture rap0so  路  13Comments

AlexanderKaran picture AlexanderKaran  路  22Comments

FredyC picture FredyC  路  20Comments

ranm8 picture ranm8  路  14Comments

iboldurev picture iboldurev  路  12Comments