Skip to content

bit uninstall incorrectly reports detached environments and produces bit-env-specific installation warnings #10505

Description

@rvnlord

Summary

bit uninstall often reports that environments are detached (not loaded) even though they are correctly configured as confirmed by the VS Code extension and bit status. The issue appears to be specific to bit-env and is independent of the package being installed or uninstalled. It isn't occuring consistently though.

For example, uninstalling @teambit/defender.linter produces:

PS > bit uninstall @teambit/defender.linter

installing dependencies in workspace using pnpm (teambit.dependencies/pnpm)

⚠ environment with ID: bitdev.general/envs/bit-env@5.0.12 configured on component projects/commonlib/envs/my-react-env was not loaded (run "bit install")
⚠ environment with ID: projects/commonlib/envs/my-react-env configured on component projects/commonlib/components/my-css-grid was not loaded (run "bit install")

Running bit install is unnecessary as the environments are already configured and functioning correctly. It wouldn't clear that issue either.

The warning is also emitted for different packages, suggesting it isn't related to @teambit/defender.linter itself but rather to how bit-env is resolved during dependency operations.

Additional warnings during install/uninstall

During some postinstall scripts on Windows (and occasionally during uninstall operations), additional warnings are produced:

WARN Failed to create bin at G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.bit_roots\bitdev.general_envs_bit-env@5.0.12\node_modules\.bin\ts-node-cwd. ENOENT: no such file or directory, stat 'G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\ts-node@10.9.2_@swc+core@1._5f208a1c522962a15b3f763d4f88a963\node_modules\ts-node\dist\bin-cwd.js.EXE'

WARN Failed to create bin at G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.bit_roots\bitdev.general_envs_bit-env@5.0.12\node_modules\.bin\ts-node. ENOENT: no such file or directory, stat 'G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\ts-node@10.9.2_@swc+core@1._5f208a1c522962a15b3f763d4f88a963\node_modules\ts-node\dist\bin.js.EXE'

WARN Failed to create bin at G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.bit_roots\bitdev.general_envs_bit-env@5.0.12\node_modules\.bin\ts-node-esm. ENOENT: no such file or directory, stat 'G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\ts-node@10.9.2_@swc+core@1._5f208a1c522962a15b3f763d4f88a963\node_modules\ts-node\dist\bin-esm.js.EXE'

WARN Failed to create bin at G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.bit_roots\bitdev.general_envs_bit-env@5.0.12\node_modules\.bin\ts-node-script. ENOENT: no such file or directory, stat 'G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\ts-node@10.9.2_@swc+core@1._5f208a1c522962a15b3f763d4f88a963\node_modules\ts-node\dist\bin-script.js.EXE'

WARN Failed to create bin at G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.bit_roots\bitdev.general_envs_bit-env@5.0.12\node_modules\.bin\ts-node-transpile-only. ENOENT: no such file or directory, stat 'G:\Moje Pliki\Programowanie\TypeScript\Bit\node_modules\.pnpm\ts-node@10.9.2_@swc+core@1._5f208a1c522962a15b3f763d4f88a963\node_modules\ts-node\dist\bin-transpile.js.EXE'

These warnings are also related to bit-env and don't seem to prevent Bit from functioning correctly afterward.

Additionally, they look to be Windows-specific ENOENT warnings which suggest that bit-env is attempting to create ts-node executable shims that do not exist at the expected location during some stages of the installation/uninstallation lifecycle. It is possible that this is a timing issue or that the binaries are being resolved before their target files are available, but I haven't investigated the underlying cause further so far.

Expected behavior

  • bit uninstall should not report unloaded environments when they are correctly configured.
  • bit install should only be suggested when the environment genuinely cannot be resolved.
  • bit-env should not produce ENOENT warnings while creating ts-node binaries during postinstall or uninstall operations.

You also asked me to reopen this but I don't have permissions: #10480 (comment). Either way, it's worth a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions