Thursday, July 21, 2022

angular or another framework/language: Mysterious compilation errors suddenly appeared after restarting app

 

>PROBLEM

Mysterious compilation errors suddenly appeared after restarting app.
It may happen with any framework/language.

Context:
Everything was done right and the modifications implemented were compiled successfully. Suddenly, after restarting the app, many error messages come from nowhere and they seem not compatible with the code written.




>SOLUTION

When the compilation goes mad, indicates that something outside the project, pertaining to the O.S. system has come to the scene.

Most common causes that occurred to me:
- HD issue
- Corrupted files.
- Non-visible chars (the worst scenario) resulting in unexpected combinations..

The first two causes may be easier to find out.
The third may turn your search into hell.

Through the editor used during the project implementation may not help, because the issue in this cases usually comes transparent to it. For instance, if you are using VS Code (excellent), it will be necessary to use another one to identify the issue, for instance the Notepad++, SciTE, or another one.

In the image below, check the red arrow.
The strange char comes out.

It doesn't help correcting in the editor. The issue may persist because it may have not visible chars during the fix, and they will be still there and may cause more issues.

The best thing to do is to create a new file and retype the code.
You may risk doing just this with just the defective line.
Better if you replace all the code from another source or manually.


This kind of issue happened to me three times and the first one drove me crazy.


>VERSIONING CONTROL  SIDE EFFECTS (Git, etc.)

The versioning is also affected.
The best approach, because it is faster and more effective, is:

1. Copy the current code to a temporary folder.
2. Checkout to a previous version — the most recent state that compiles successfully.
3. Replace the differences without copying, otherwise, you may contaminate the content again.

NOTE:
Non-visible chars produce issues to the compiler and also to any other software working with the files, and that is the case of the versioning control, spoiling the merges.

>ENV

Windows
Node.js
Angular 12 and higher.



No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...