Ts-node-dev: Lots of Something.default is not a function

Created on 22 Sep 2020  路  7Comments  路  Source: wclr/ts-node-dev

Hi there!
Since I upgraded from pre51 to pre61, I have a lot of errors like Something.default is not a function on start. This seems to happen more often when the computer is under load and thus maybe the compilation is slower?
The project is a webserver with Apollo GraphQL and all those functions are expected to be loaded the first time a requests comes in. It does look like a race condition where the server starts accepting requests but the new code is not fully compiled or loaded. Is there a way I could help debug that?
Thanks a lot for the hard work ;)

Most helpful comment

Also have the same problem, but it seems to be specific to platforms. On Linux I don't get the weird errors, but on OSX I do. I get erros like Something.default is not a function like mentioned above, and others like Cannot read property "name" of undefined where the variable is not undefined at all (since it's static or the env variables).

Building with typescript cli doesn't return any error, nor does running the built js files with node. Also, running it with ts-node by itself works too (latest version).

All 7 comments

Also have the same problem, but it seems to be specific to platforms. On Linux I don't get the weird errors, but on OSX I do. I get erros like Something.default is not a function like mentioned above, and others like Cannot read property "name" of undefined where the variable is not undefined at all (since it's static or the env variables).

Building with typescript cli doesn't return any error, nor does running the built js files with node. Also, running it with ts-node by itself works too (latest version).

Not sure, there is a --debug flag and you can use custom --cache-directory where you can find compiled sources. Also check if it works with ts-node.

Happy that we are not alone, I will dig a bit more into that!

I have this issue at work too, and not sure what is causing it at the moment. Most of the time when this occurs, a simple restart will do. However, some of the machines are totally unable to get the app started because of this error.

Interested to know if there is a fix for this, will also try to turn on --debug to see if there's anything useful

I suspect this is the same thing as https://github.com/whitecolor/ts-node-dev/issues/185 ?

Yes, I think it is

Just reporting that the error is still preset in 1.0.0 with latest TS and ts-node

Was this page helpful?
0 / 5 - 0 ratings

Related issues

capc0 picture capc0  路  5Comments

quantuminformation picture quantuminformation  路  7Comments

IAfanasov picture IAfanasov  路  11Comments

kachkaev picture kachkaev  路  11Comments

pvtri96 picture pvtri96  路  10Comments