teambit / bit

A build system for development of composable software.

Home Page:https://bit.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bit login Cannot read properties of undefined (reading ‘defaultScope’)

CGottschallJ opened this issue · comments

Describe the bug

Ran the command npx @teambit/bvm install and then attempted to run bit login. Once the prompts came up, we responded n to the first and no to the second but received the error Cannot read properties of undefined (reading ‘defaultScope’)

Now every command we run, including bit uninstall prints this error message to the console.

Our previous workflow was to run npm install bit-bin -g then bit login. Is this still an option?

Steps to Reproduce

  1. Ran the command npx @teambit/bvm install
  2. bit login
  3. select n for the first prompt and no for the second when asked
  4. Error appears

Expected Behavior

I expect the error not to show up and I expect to be able to login.

Specifications

  • Bit version: 1.5
  • Workspace type: (harmony/legacy)
  • Node version: 16
  • npm / yarn version: npm
  • Platform: macOS

Can you please run bit login --log and attach the log here?
bit-bin is not an option any more. It's the legacy version that is not maintained for a few years by now

It looks like there's a general issue with installing bit via npx when legacy is installed

Please install bvm locally via npm i -g @teambit/bvm and then continue with your bit versions installation. Before you do this please remove any bit versions installed via npx (npx @teambit/bvm remove )

Then check both bit -v and bbit -v and make sure that one of them is 1.x.x to make sure that you've installed the new version correctly. You should now be able to run bit login successfully.

Also, if you dont need the legacy version of bit any more, please remove it from your system to reduce the chances of any 'flare ups' of your system (or any colleagues) getting confused between the two.

I have the same problem. This is logging

*** Loading Bit *** argv:
/Users/pu/.bvm/nodejs/20.10.0/bin/node
/Users/pu/.bvm/links/bit/node_modules/@teambit/bit/bin/bit
login
--log
got an error from command login: TypeError: Cannot read properties of undefined (reading 'defaultScope')
    err: {
      "type": "TypeError",
      "message": "Cannot read properties of undefined (reading 'defaultScope')",
      "stack":
          TypeError: Cannot read properties of undefined (reading 'defaultScope')
              at attachVersionsFromBitmap (/Users/pu/.bvm/versions/1.6.62/bit-1.6.62/node_modules/@teambit/bit/dist/load-bit.js:286:65)
              at getConfig (/Users/pu/.bvm/versions/1.6.62/bit-1.6.62/node_modules/@teambit/bit/dist/load-bit.js:237:12)
              at async loadBit (/Users/pu/.bvm/versions/1.6.62/bit-1.6.62/node_modules/@teambit/bit/dist/load-bit.js:373:18)
              at async runCLI (/Users/pu/.bvm/versions/1.6.62/bit-1.6.62/node_modules/@teambit/bit/dist/load-bit.js:412:19)
              at async initApp (/Users/pu/.bvm/versions/1.6.62/bit-1.6.62/node_modules/@teambit/bit/dist/app.js:48:5)
    }
Cannot read properties of undefined (reading 'defaultScope')
[+] CLI-OUTPUT: Cannot read properties of undefined (reading 'defaultScope')
[*] the command "login" has been terminated with an error code 1

@AsaRory can you please share complete steps to reproduce the error?
is this bit login command ran in a new project? if so, what is the exact syntax you used to create it?

also, in your workspace.jsonc file, do you have an entry called defaultScope, if so - what is the content of that property?

@itaymendel
image
My bit version is 1.6.62, and I run the bit init command and find 286 lines of load-bit.js const defaultScope = rawConfig['teambit.workspace/workspace'].defaultScope; RawConfig no teambit here. The workspace/workspace configuration, is not only the login command, most of the other orders have influence, may before and I was also associated with other versions of the bit. I'll try again when I clear it

@AsaRory

Can you please share your workspace.jsonc file? Likely there is something misconfigured there.

@luvkapur I'm sorry. Everything was fine when I rebooted the computer. Maybe it's because I've installed other versions of bit before.