Cannot export staged components
Description
Hello,
I am still new to bit. I love bit's vision but so far I have experiences that I need to bring a lot of patience to configure and debug when working with bit. I am currently facing an issue where I am not sure whether it is a bug. This issue is currently blocking a customer project so I am quite desperate to solve it.
I have created new react components and hooks. I have successfully tagged them. bit status indicates that they are staged. When I enter bit export I received the following error:
hash <a-long-hash-number> not found
run 'bit doctor' to get detailed workspace diagnosis and issue resolution.
** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **
hash <a-long-hash-number> not found
run 'bit doctor' to get detailed workspace diagnosis and issue resolution.
I have anynomized that hash since I am unsure if I should keep it confidential. I have also run bit export --log to receive more detailed information. I received the following:
exporting componentsrepository.clearCache
got an error from command export: HashNotFound
HashNotFound
at Repository.loadSync (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/legacy/dist/scope/objects/repository.js:504:15)
at ExportMain.getIdWithUpdatedScope (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:801:46)
at /Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/dependency-resolver/dist/dependency-resolver.main.runtime.js:1082:26
at Array.forEach (<anonymous>)
at DependencyResolverMain.updateDepsOnLegacyExport (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/dependency-resolver/dist/dependency-resolver.main.runtime.js:1079:18)
at /Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:734:24
at Array.map (<anonymous>)
at ExportMain.convertToCorrectScopeHarmony (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:731:67)
at processModelComponent (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:525:20)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async pMapSeries (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/p-map-series/index.js:9:15)
at async getUpdatedObjectsToExport (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:550:7)
at async pMapSeries (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/p-map-series/index.js:9:15)
at async ExportMain.exportMany (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:573:118)
at async ExportMain.exportComponents (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:351:9)
at async ExportMain.export (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:286:9)
hash <a-long-hash-number> not found
run 'bit doctor' to get detailed workspace diagnosis and issue resolution.
** unhandled rejection found, please make sure the promise is resolved/rejected correctly! **
got an error from command export: HashNotFound
HashNotFound
at Repository.loadSync (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/legacy/dist/scope/objects/repository.js:504:15)
at getIdWithUpdatedScope (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:801:46)
at /Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:749:36
at Array.forEach (<anonymous>)
at changeDependencyScope (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:748:36)
at /Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:732:35
at Array.map (<anonymous>)
at ExportMain.convertToCorrectScopeHarmony (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:731:67)
at processModelComponent (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:525:20)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async pMapSeries (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/p-map-series/index.js:9:15)
at async getUpdatedObjectsToExport (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:550:7)
at async pMapSeries (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/p-map-series/index.js:9:15)
at async ExportMain.exportMany (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:573:118)
at async ExportMain.exportComponents (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:351:9)
at async ExportMain.export (/Users/duc/.bvm/versions/0.1.42/bit-0.1.42/node_modules/@teambit/export/dist/export.main.runtime.js:286:9)
hash <a-long-hash-number> not found
run 'bit doctor' to get detailed workspace diagnosis and issue resolution.
[+] CLI-OUTPUT: hash <a-long-hash-number> not found
run 'bit doctor' to get detailed workspace diagnosis and issue resolution.
[*] the command "export" has been terminated with an error code 1
Running bit doctor indicates the following:
║ category │ name │ description │ status ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ configuration │ validate workspace's bit config │ validate workspace configuration object │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ vendors │ validate git exec │ validate that git executable found │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ internal store │ check orphan refs │ checks for empty internal refs in local workspace │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ local environments │ check environment symlinks │ validate generated symlinks for workspace environments │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ vendors │ validate npm exec │ validate that npm executable found │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ vendors │ validate yarn exec │ validate that yarn executable found │ passed ║
╟────────────────────┼─────────────────────────────────┼────────────────────────────────────────────────────────┼────────╢
║ core │ validate bit version │ validate that bit version is up to date │ passed
Specifications
- Bit version: 0.1.42
- Node version: v16.16.0
- npm / yarn version: 8.11.0/ 1.22.19
- Platform: darwin
- Bit compiler (include version): Where can I find it?
- Bit tester (include version): Where can I find it?
Context and additional information
What did I try:
- Delete all
node_modulesandpnpm-lock.yamland runbit installandbit compile - Run
bit clear-cache - Try out the same with bit version
0.1.27and0.1.36 - Delete bit cache folder in
user/Library/bit - Workaround: I can export component by component
Thank you very much for your help in advance, Duc
That's strange. It's the first time I see an issue in this function getIdWithUpdatedScope.
This is running when you first export a component. It loads the component by its name only without the scope from the local scope. In your case, it wasn't able to find it. Not sure why. It gets created during the tag/snap.
Try running bit cat-scope and check whether you see this component there. If you see it there, run bit cat-object -p <hash> with the hash you see in the previous command.
Also, check whether this hash is the same hash you got an error previously.
The hash is not confidential. You can only conclude the component-name by it.
@davidfirst thanks for reaching back to me so quickly. In the meantime I was able to nail the error down to one component. It was listed under changed components and modified components when running bit status. It was not pushed to the remote scope before. My workaround was to remove the tags, set the env and then tag it again. Now the export works. But I have no idea what was wrong
I assume that the hash is not valid anymore and I tried out your command and as assumed, it did not find this file anymore. But I will keep this command in mind when. I am facing this issue again. And thanks for the explanation!
OK, Yes, I was about to suggest a workaround to run bit reset and then tag/snap again. I'm happy that you were able to work around this.
If it happens again, please let me know. You can also post in the Slack channel and tag me.
Closing this for now, feel free to re-open when needed.