bit icon indicating copy to clipboard operation
bit copied to clipboard

Module @teambit\\legacy\\bin\\bit.js not found

Open JanDa-ma opened this issue 2 years ago • 3 comments

Hi there, I have installed bvm and bit.

C:\Users\Damma>bvm version

current (used) bvm version: 0.0.34
latest available bvm version: 0.0.34
current (used) bit version: 0.0.668
latest installed bit version: 0.0.668
latest available bit version: 0.0.668
When I run the command bit, this is the output

C:\Users\Damma>bit

internal/modules/cjs/loader.js:888
  throw err;
  ^
Error: Cannot find module '../node_modules/@teambit/bit/dist/app'
Require stack:
- C:\Users\Damma\AppData\Roaming\npm\node_modules\@teambit\legacy\bin\bit.js
←[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:730:27)←[39m
←[90m    at Module.require (internal/modules/cjs/loader.js:957:19)←[39m
←[90m    at require (internal/modules/cjs/helpers.js:88:18)←[39m
    at Object.<anonymous> (C:\Users\Damma\AppData\Roaming\npm\node_modules\←[4m@teambit←[24m\legacy\bin\bit.js:3:1)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1068:30)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:933:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:774:14)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: [
    ←[32m'C:\\Users\\Damma\\AppData\\Roaming\\npm\\node_modules\\@teambit\\legacy\\bin\\bit.js'←[39m
  ]
}

Do you know how to solve this?

JanDa-ma avatar Mar 04 '22 08:03 JanDa-ma

Recently we've faced this issue too on Windows. Any news on this one?

AntGrisha avatar Jun 09 '22 07:06 AntGrisha

I am also seeing this same error when my pre-commit hook (using lint-staged) runs the command bit build. Strangely however, running this command manually doesn't result in this error and it works just fine.

ramkrishna757575 avatar Jun 24 '22 15:06 ramkrishna757575

I have the same issue following the Quick Start guide when you try to fork the second component under Building the Components section.

denjalonso avatar Jun 28 '22 11:06 denjalonso

I have this issue when running bit compile && bit link as a post install script. The error doesn't occur the first time pnpm install is run, but every subsequent run after that it does. I can also run bit compile && bit link manually with no issues.

bpred754 avatar Nov 06 '22 13:11 bpred754

@JanDa-ma try to run npm i @teambit/bvm inside your workspace and then run bit start again

mariusorani avatar Nov 10 '22 14:11 mariusorani

My initial "bit compile && bit link" was working ok but any attempt to run bit would fail after that unless i deleted my node_modules

this is because after I run "bit install" i would then have new copy of bit command in node modules/.bin/bit but have the dependency "@teambit/bvm" missing.

But dont go installing the dependency. I think "bit" assumes you be using the global install of bit.

I had this issue because i set my PATH incorrectly in my .bash_profile after following some instructions incorrectly (see https://bit.dev/reference/reference/using-bvm/#troubleshooting)

I had export PATH="$PATH:/Users/user/bin" but should be export PATH="/Users/user/bin:$PATH"

I hope this helps someone.

oscarIAG avatar Jan 31 '23 01:01 oscarIAG

issue is no longer relevant.

installation for bit should be done by BVM, as noted in the docs.

itaymendel avatar Mar 14 '23 14:03 itaymendel