teambit / envs

Component development environments for the Bit community
https://bit.dev/bit/envs
Other
64 stars 9 forks source link

`Cannot read property 'split' of undefined` when trying to compile a component #86

Closed DeyLak closed 3 years ago

DeyLak commented 4 years ago

Describe the bug

I just tried to update my ts compiler and now I'm getting this error, when trying to build a component:

error: bit failed to build pik-pro.mobile-apps/pages/page-profile@1.9.13 with the following exception:
Cannot read property 'split' of undefined
TypeError: Cannot read property 'split' of undefined
    at getNameOfFile (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:301:56)
    at /Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:213:48
    at step (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:33:23)
    at Object.next (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:14:53)
    at /Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:4:12)
    at createConfigFile (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:209:12)
    at /Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:104:23
    at step (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:33:23)
    at Object.next (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:14:53)
    at /Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:4:12)
    at preCompile (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:100:12)
    at Object.<anonymous> (/Users/deylak/Desktop/ForLovelyMe/Repository/pik-pro-master-app/.git/bit/components/compilers/typescript/bit.envs/3.1.38/dist/ts-compiler/src/compile.js:73:32)

I used version 3.1.0 previously and it worked fine. Now I'm trying to update to ts@3.7.5 and all compiler versions with that release of typescript are throwing this error.

Specifications

Additional context

I can provide access to my collection to show an example of this, if you'll have troubles with reproducing this.

JoshK2 commented 4 years ago

Hey, can you please provide more information about the component you try to build and what are the files inside the component, also if you write a special configuration with rawConfig please provide it so I'll be able to reproduce the error.

DeyLak commented 4 years ago

@JoshK2 I've provided you access to the collection. Try these steps:

  1. Create empty workspace
  2. bit import pik-pro.mobile-apps/pages/page-profile
  3. Change the compiler of the component in it's package.json
  4. Try build the component
JoshK2 commented 4 years ago

@DeyLak , I can't access the collection, please add me directly in the collection of the component.

DeyLak commented 4 years ago

@JoshK2 sorry, I've added you only to organisation. Please, try again.

JoshK2 commented 4 years ago

@JoshK2 I've provided you access to the collection. Try these steps:

  1. Create empty workspace
  2. bit import pik-pro.mobile-apps/pages/page-profile
  3. Change the compiler of the component in it's package.json
  4. Try build the component

@DeyLak , I do exactly these setups and it works fine for me with both https://bit.dev/bit/envs/compilers/react-typescript?version=3.1.43 and https://bit.dev/bit/envs/compilers/typescript?version=3.1.38

Maybe we missing something.

JoshK2 commented 4 years ago

@DeyLak , maybe you can send me a tar file, so I'll be able to reproduce it.

DeyLak commented 4 years ago

@JoshK2 I've discovered, that this error seems to occur only once, when changing the compiler. If I ran build second time, it builds successfully. I've sent you an email with a bit workspace. Try reproducing it on this archive. It contains all the node_modules but the compiler is not installed. After first run of bit build it will work. You can bump compiler version to see the error again, I think.

JoshK2 commented 4 years ago

I debug it, and the issue is whit bit and not with the compiler, I opened an issue in bit repo: https://github.com/teambit/bit/issues/2297 @GiladShoham @davidfirst