Troubleshooting

This describes common pitfalls to which you can get during compilation or development, and how to solve them. These problems usually produce errors that are not so intuitive, so make sure you read this page.

This is sub-layout for documentation pages

Contents

[hide]
Top
1.1 Is it safe to stop the compilation script?

Considering client side compilation, NO, it is NOT safe, it can leave the source codes half-replaced. That can be reverted with another script, but better not to do it.

Considering server side compilation, YES, it is safe, as replacement occurs only in build directory.

2.1 TypeError: Class extends value undefined is not a constructor or null

Steps preceeding this error:

• The project was compiled and ran normally
• Then, changes to code were done
• Project was compiled without any errors
• Upon running, error shows up

Solution

This happens, because you have class A extending B, and in B you import class A by accident.

2.2 Upon compiling, the added code does not propagate to final application (server or client) at all

Steps preceeding this error:

• The project was compiled and ran normally
• Class files were moved
• Then, changes to code were done (maybe printing some output)
• Project was compiled without any errors
• Project runs, but it does not print anything -> no changes you did to the code are in compiled application
Solution

Delete build folder, and compile all again

This happens, because the compiled classes persist in build, and the dependencies. Moreover, because upon compiling, the compiled files that are no longer needed are not deleted.

Example:

• File app/model/Player.ts was moved to app/Player.ts
• In build, app/model/Player.js still exists
• Project is compiled
• In build, app/Player.js is created, but app/model/Player.js still exists
• By having old path to the old file Player.js, which still exists, all other .js files, are actually using this old Player.js.
That is, because compiling compiles only changed files, leaving the unchanged file sources with their old paths.

2.3 Upon cleaning and compiling project, weird and insane errors start to emerge

Errors can be following:

Solution

The reason why this can happen if when you backup build directory to the src folder.
For example using:
mv build build_old
Then, the compile script will create new build directory, but tsc will try to compile all sources in build_old directory as well.

Remove the build_old directory or put it out from the src directory.

2.4 Cannot find module '@XXX'

To resolve this, we will use following command to only compile the project, but save the path resolution to a log:

   tsc --traceResolution > dump

There will be alot of output, so use CTRL + F to find the name of the nodule, for which the resolution fails, in this case @ContainerSortTesterSuiteLinkedList'

Here is an excerpt that relates to the module at which our resolution fails.
  ======== Resolving module '@ContainerSortTesterSuiteLinkedList' from '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/containers/linkedList/LinkedListMergeSorterTest.ts'. ========
Module resolution kind is not specified, using 'NodeJs'.
'baseUrl' option is set to '/var/www/html/nodeJsDol/src', using this value to resolve non-relative module name '@ContainerSortTesterSuiteLinkedList'.
'paths' option is specified, looking for a pattern to match module name '@ContainerSortTesterSuiteLinkedList'.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/containers/linkedList/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/containers/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/node_modules' does not exist, skipping all lookups in it.
Directory '/var/node_modules' does not exist, skipping all lookups in it.
Directory '/node_modules' does not exist, skipping all lookups in it.
'baseUrl' option is set to '/var/www/html/nodeJsDol/src', using this value to resolve non-relative module name '@ContainerSortTesterSuiteLinkedList'.
'paths' option is specified, looking for a pattern to match module name '@ContainerSortTesterSuiteLinkedList'.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/containers/linkedList/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/containers/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/other/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/model/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/shared/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/app/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/offline/node_modules' does not exist, skipping all lookups in it.
Directory '/var/www/html/nodeJsDol/src/test/node_modules' does not exist, skipping all lookups in it.