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.



Wednesday, July 20, 2022

angular: Error: node_modules/ngx-bootstrap/modal/bs-modal.service.d.ts:7:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

 


>PROBLEM

Angular compilation throws the following error:

Error: node_modules/ngx-bootstrap/modal/bs-modal.service.d.ts:7:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (ngx-bootstrap/modal) which declares BsModalService has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.


>SOLUTION

>BEFORE (WRONG)

imports: [

BsModalService,

],

providers: [

],


>AFTER (RIGHT)

imports: [

BsModalService,

],

providers: [

BsModalService,

],




>ENV

Angular CLI: 13.2.2

Node: 16.13.1

Package Manager: npm 8.5.4

OS: win32 x64


angular: Error: node_modules/ngx-bootstrap/datepicker/bs-datepicker.config.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

 

>PROBLEM

Angular compilation returns:

Error: node_modules/ngx-bootstrap/datepicker/bs-datepicker.config.d.ts:8:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.


This likely means that the library (ngx-bootstrap/datepicker) which declares BsDatepickerConfig has not been processed correctly by ngcc, or is not compatible with Angular Ivy. 

Check if a newer version of the library is available, and update if so. 

Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy. 



>SOLUTION


Edit app.module.ts and fix its configuration as follows:


>BEFORE (WRONG)

  imports: [

AlertConfig, 

BsDropdownConfig, 

BsDatepickerConfig

  ],

  providers: [],


>AFTER (RIGHT)

  imports: [

  ],

  providers: [AlertConfig, BsDropdownConfig, BsDatepickerConfig],



>ENV

Angular CLI: 13.2.2

Node: 16.13.1

Package Manager: npm 8.5.4

OS: win32 x64


Thursday, July 14, 2022

angular: ngForm: error NG8002: Can't bind to 'formControl' since it isn't a known property of 'input'.

 

>PROBLEM

After adding an implementation to bind using ngModel , for instance:

    <label for="example-ngModel">[(ngModel)]:</label>

    <input [(ngModel)]="currentItem.name" id="example-ngModel">


Running angular using ngModels, returns the error message:

error NG8002: Can't bind to 'ngModel' since it isn't a known property of 'input'
Can't bind to 'formGroup' since it isn't a known property of 'form'

Error: src/app/crud/crud-employee/crud-employee-update/crud-employee-update.component.html:2:9 - error NG8002: Can't bind to 'formGroup' since it isn't a known property of 'form'.

2   <form [formGroup]="updateForm" (ngSubmit)="saveToList(updateForm)">


For instance, implementing a simple example like this:




You get:




Another example:



>SOLUTION


@NgModule is a key concern in Angular.

This NG8002 error usually comes from the @NgModule misconfiguration (missing something).
For instance, a usual occurrence may happen with these scenarios:

1. A new module is created and not registered on app.module.ts.
or

2. A new component is created and not registered in its specific module.
or

3. The selector's module is not registered in the module.

The selector is that declared in the .ts file, for instance at:
@Component({
  selector: 'app-modal-list',

Referenced in the .html file comes like this:
<app-modal-list></app-modal-list>



There are a few things to be observed.


1. Requires modules setup.

Set the required modules in app.modules.ts. Example:


import { FormsModule, ReactiveFormsModule } from "@angular/forms";

...

@NgModule({

  declarations: [
        //...
   ],

  imports: [
//...
    FormsModule,
    ReactiveFormsModule,
  ],


*** IMPORTANT NOTE:

If you are using a page under its specific module, declare in that module too.

Example:

app
+--forms-lab
+-- forms1
--- forms-lab.module.ts


Edit forms-lab.module.ts and declare both modules referred to above.


2. Make sure that you have not overwritten the angular modules: 

It is something easy to happen, for instance, if you create a module called forms, as it is:


ng g m forms


This command will generate a FormsModule that overrides the angular's module.
This conflict causes the same issue.

If it happened, delete, and recreate it with another name.


3. Check if all components are declared in its modules.ts file.

Using the example above, it would be something like this in the forms-lab.module.ts file:

import { Forms1Component } from './forms1/forms1.component';
...
@NgModule({
  declarations: [
    Forms1Component,
  ],


4. Check if there isn't naming conflict.

Sometimes, the way the components are named may cause the issue.

Check the following image:




@MORE: 

https://stackoverflow.com/questions/43220348/cant-bind-to-formcontrol-since-it-isnt-a-known-property-of-input-angular


>ENV

Angular CLI: 13.2.2

Node: 16.13.1

Package Manager: npm 8.5.4

OS: win32 x64


Friday, July 8, 2022

node.js: express: req.session returns "undefined"

 

>PROBLEM

node.js: express: req.session returns "undefined".

console.log(req.session)

- Returns:

undefined


>SOLUTION

The session block declaration shall come before the routing blocks.


>>BEFORE

// error handler
app.use(function (err, req, res, next) {
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};
  res.status(err.status || 500);
  res.render('error');
});

// ...

const session = require('express-session');
app.set('trust proxy', 1) // trust first proxy
app.use(session({
    secret: ConfigSvc.configValue('sessionKey'),
    saveUninitialized:true,
    cookie: { maxAge: oneDay, secure: true },
    resave: false
}));


>>AFTER

var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var todoRouter = require('./routes/todo');

var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({
  extended: false
}));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

var favicon = require('serve-favicon');
const ConfigSvc = require('./utils/ConfigSvc');
app.use(favicon(__dirname + '/public/favicon.ico'));

const oneDay = 8640000;
const session = require('express-session');
app.set('trust proxy', 1) // trust first proxy
app.use(session({
    secret: ConfigSvc.configValue('sessionKey'),
    saveUninitialized:true,
    cookie: { maxAge: oneDay, secure: true },
    resave: false
}));

app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/todo', todoRouter);

// catch 404 and forward to error handler
app.use(function (req, res, next) {
  next(createError(404));
});


// error handler
app.use(function (err, req, res, next) {
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};
  res.status(err.status || 500);
  res.render('error');
});


>ENV

Node.js 16
Express
JWT

Wednesday, June 29, 2022

linux: debian: ubuntu: How to discover an application and its service to handle it


>PROBLEM

Scenario by example:
On a linux(debian, ubuntu, etc) system you want to discover the postgresql service, its version and how to stop/start.


>SOLUTION


Alternative ways to discover a service:

1. whereis

2. locate

3. ps aux 

Ex.: ps aux | grep postgres

/usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf

4. systemctl

returns all registerd services


Using systemctl (newer)

systemctl stop ssh

systemctl disable ssh

systemctl enable ssh

systemctl start ssh

systemctl status ssh


Using service

service  postgresql status

service  postgresql start

service  postgresql stop


>ENV

linux/debian

Thursday, June 23, 2022

docker commit lost data

 >PROBLEM

Suppose the following scenario.
 
1. You have create a container mapping to an internal directory.
Example:
docker run -it --name d10n16p11v1 -p 5000:3000 --mount "target=/home/data" d10n16p11:latest /bin/bash

2. Inside the container you created content under /home/data.
For instance:
git clone someURL

After the clone you get a new dir, for instance:
myproject

So you have:
/home/data/myproject

3. Eventually, you decide to preserve the changes and all the stuff (the full state), then you do:

docker commit d10n16p11v1 local/d10n16p11v1

- or using the CONTAINER ID:
docker commit 156e4a967258 local/d10n16p11v1

4. Using the new image, you create a container from it doing:

docker run -it --name d10n16p11v2 -p 5000:3000 --mount "target=/home/data" local/d10n16p11v1 /bin/bash

Accessing the prompt you search for your content:
ls /home/data

but unfortunately, the "myproject" downloaded on the previous container is not there — it is lost!


>SOLUTION

Before exiting the container, copy the content from under the folder that you mapped to create it, in this example is "/home/data" to a system's directory, for instance "/opt".

cp -R /home/data /opt

After, you may commit (step #3).
Next time you run the new container from the committed image, the /opt directory will contain your stuff under data.

IMPORTANT:
Before deleting the previous image or container, test your new image.

>ENV

docker
debian 10

Monday, May 2, 2022

git: hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead

 

>PROBLEM


On Windows, after running a git command, it is thrown the following warning:

  hint: core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead

  hint: Disable this message with "git config advice.useCoreFSMonitorConfig false"



>SOLUTION


core.fsmonitor

If set to true, enable the built-in file system monitor daemon for this working directory (git-fsmonitor--daemon[1]).

Like hook-based file system monitors, the built-in file system monitor can speed up Git commands that need to refresh the Git index 

(e.g. git status) in a working directory with many files. 

The built-in monitor eliminates the need to install and maintain an external third-party tool. 


- Documentation:
https://git-scm.com/docs/git-config#Documentation/git-config.txt-corefsmonitor


Run the desired option:

git config core.fsmonitor true

or

git config core.fsmonitor false


*** IMPORTANT NOTE:

Run the command on the git's root folder.

Make sure that the git folder is not another git subdirectory of a root git folder.

Example:

+-- project

.git

myStuff

+-- project2

.git

myStuff2



>ENV

git version 2.36.0.windows.1

Windows 10


Friday, April 29, 2022

eclipse: maven: Error: Could not find or load main class antlr.debug.misc.ASTFrame

 


>PROBLEM


Attempt to run an Eclipse project returns the following error:


  Error: Could not find or load main class antlr.debug.misc.ASTFrame

  Caused by: java.lang.ClassNotFoundException: antlr.debug.misc.ASTFrame


>SOLUTION

NOTE:
If you are quite sure about your project configuration, try to go straight to the 6th step.


0. Pre-requisite: make sure your pom.xml configuration is correct.


1. On Eclipse, using the Project Explorer (or Navigator), delete the following configuration files:

  .settings

  .classpath




2. Eclipse will complaing throwing an error pop-up. Ignore closing it.


3. Using the Project Explorer (or Navigator), point to the project's root and save it again.

This will generate again the deleted files.


4. Check if there are errors and fix them.




5. Clean the project (menu, Project, Clean...).



Wait to finish. Pay attention on the bottom bar.




6.  Fix the the Eclipse's configuration to run the application.





7. Run the application again and choose the proper option for the project.
In this case is Spring Boot.




8.  Configuration fixed and application is up and running.





>ENV

maven

eclipse

java17


Monday, April 25, 2022

maven: Execution default-testResources of goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources failed: Unable to load the mojo 'testResources'


 >PROBLEM


The pom.xml shows the following error message:


Execution default-testResources of goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources failed: Unable to load the mojo 'testResources' 

(or one of its required components) from the plugin 'org.apache.maven.plugins:maven-resources-plugin:3.2.0' 

(org.apache.maven.plugins:maven-resources-plugin:3.2.0:testResources:default-testResources:process-test-resources)



>SOLUTION


If the pom.xml was previously working fine, just update the maven project.

If using Eclipse, do:

Point to the project root on "Project Explorer" or equivalent, choose on the context menu mave, Updata Project (or ALT+F5)


>ENV

spring

java


maven: Caused by: java.lang.ClassNotFoundException: com.drillback.sgsup.Application

>PROBLEM


Running the executable jar with dependencies generated by maven plugin fails throwing the error message:

  java -jar myApp-0.0.1-SNAPSHOT-jar-with-dependencies.jar


- Returns:

  ..Caused by: java.lang.ClassNotFoundException..



>SOLUTION


1. Check the main class path in the pom.xml file.

Note: there are alternative plugins to generate executable jars.

See more at: 
How to Create an Executable JAR with Maven


Below is shown one of the options:


<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>package.appName.MainClass</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>



2. If the plugins's configuration is correct, check the dependencies included in the project's pom.
For instance, if it was included lombok as shown below, remove it and test again:

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>



>ENV


java
spring
maven

Thursday, April 14, 2022

MongoDB: Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method)


>PROBLEM

Starting a project using Maven, JEE/Spring, and MongoDB driver (mongo-java-driver) throws the following exception:

...[cluster-ClusterId{value='62586e27f362ec2cd1336bda', description='null'}-localhost:27027] # INFO  # org.mongodb.driver.cluster # method: info # Exception in monitor thread while connecting to server localhost:27027

com.mongodb.MongoSocketOpenException: Exception opening socket

...

Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method)


>SOLUTION

Although connection refusal may have many causes, this post will treat one of them that maybe it is your issue.

The "mongo-java-driver" tries to start MongoDB connection automatically as soon as the application starts if it finds MongoDB's configuration in .properties or .yml files.

It happens when we start a project using this default feature but later we decide to customize it, and there is no need for this feature anymore.

So, just remove or comment on the lines in the configuration file. 


For instance, if .yml, do this:

spring:

profiles: prod

jpa:
database: default
#  data:
#    mongodb:
#      host: localhost
#      port: 27027
#      database: mydatabase


If .properties:

#spring.data.mongodb.host=localhost
#spring.data.mongodb.port=27017
#spring.data.mongodb.database=mydatabase


>ENV


SpriingBoot 2.X
Java 17
MongoDB 5

- pom.xml:


<dependency>

<groupId>org.springframework.data</groupId>

<artifactId>spring-data-mongodb</artifactId>

</dependency>


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-mongodb</artifactId>

</dependency>


<dependency>

<groupId>org.mongodb</groupId>

<artifactId>mongo-java-driver</artifactId>

<version>3.12.10</version>

</dependency>


Monday, April 11, 2022

Spring Boot: web service returns with 404

 

>PROBLEM


web service returns with 404


>SOLUTION

If you have already checked the protocol, then check if the @ResponseBody annotation is missing.


- BEFORE:


@PostMapping(value = {"/reset/{token}"})

public ResponseDTO resetPassword(HttpServletRequest request, @PathVariable String token) {

ResponseDTO dto = request(request, token);

dto.setData("hello there!");

return dto;

}



- AFTER:


@PostMapping(value = {"/reset/{token}"})

@ResponseBody

public ResponseDTO resetPassword(HttpServletRequest request, @PathVariable String token) {

ResponseDTO dto = request(request, token);

dto.setData("hello there!");

return dto;

}


>ENV

spring boot 2

java 17


Monday, February 21, 2022

eclipse: sonarlint: deactivate the @SuppressWarnings warning

 

>PROBLEM


Undesirable warning.





>SOLUTION

Go to menu, Window, Preferences and follow by the image:






>ENV

Eclipse jee-2021-12
Windows 10

Sunday, February 20, 2022

Eclipse: Store preferences has encountered a problem. An internal error occurred during "Store Preferences". The system was not able to find the filepath

 

>PROBLEM


Eclipse returns the following error after altering data on preferences (menu, Windows, Preferences):

  Store preferences has encountered a problem. An internal error occurred during "Store Preferences". The system was not able to find the filepath


>SOLUTION


- Follow the images:








>ENV


Windows 10
Eclipse jee-2021-12


eclipse: sonarlint: restore rule


>PROBLEM

Using Eclipse's sonarlint , a rule was removed and it is wished to be restored. 


>SOLUTION




>ENV

Eclipse



Wednesday, February 16, 2022

JEE, Hibernate, PostgreSQL: Caused by: org.postgresql.util.PSQLException: ERROR: must be owner of table server


 >PROBLEM


Hibernate fails when the application starts throwing the following messages:


Caused by: org.postgresql.util.PSQLException: ERROR: must be owner of table server 2022-02-16 22:18:43 # [restartedMain] # WARN  # o.h.t.s.i.ExceptionHandlerLoggedImpl # method: handleException # GenerationTarget encountered exception accepting command : 

Error executing DDL "alter table public.provider 

       add column provider_details_pk int8" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "

    alter table public.provider 

       add column provider_details_pk int8" via JDBC Statement

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "

    alter table public.server 

       add column provider_pk int8" via JDBC Statement



>SOLUTION


The tables were create via terminal using postgres' admin account that it is now allowed to remote access due to security issues.

Drop the tables that have the owner access issue using the terminal and the admin's account, the same used to create them.

Recreate the tables using another account that has remote access priviledges.


>ENV

Debian 10
PostgreSQL 10
Windows 10


Tuesday, February 8, 2022

Git: Windows: Failed to add the host to the list of known hosts


>PROBLEM

Attempt to a Git operation over remote repository returns the following message:

Could not create directory 'your path here' (No such file or directory).
Failed to add the host to the list of known hosts (/your local path here/known_hosts).

See picture where it points to "issue".






>SOLUTION 

1. Open Git Bash console.




2. Perform the command below to enable read and write;

chmod 776 your local path here/known_hosts






3. Keep the git bash console opened, test running a git command again.
For instance:

git ls-remote


The problem is gone as the figure shows where it points to "solved".




>ENV

Windows 10




[REF]: faq-Failed to add the host to the list of known hosts

Wednesday, January 12, 2022

docker: Angular client fails to call web service on docker


 >PROBLEM


You've have an Angular project that uses a web services, for instance Java Spring Boot, that works on the environment that is was created, but when the projects (the client and the WS) are migrated to Docker containers, they fail to communicate.

>SOLUTION


If the usual call using localhost fails, replace it with “host.docker.internal”.

  // usual, outside docker
  //private serverUrl = 'http://localhost:8081'

  // docker, if it fails localhost
  private serverUrl = 'http://host.docker.internal:8080'


Detailed procedure here:

>ENV

Windows 10
Docker
Angular 7..13
Node.js 12..16

Tuesday, January 11, 2022

node.js: angular: An unhandled exception occurred: require() of ES Module node_modules/@angular/compiler-cli/bundles/index.js


 >PROBLEM


- After the following procedure:


ng new myproject

npm install rxjs

npm audit fix --force

ng serve


- The angular application fails to start returning the following message:


An unhandled exception occurred: require() of ES Module node_modules/@angular/compiler-cli/bundles/index.js 

/data/prj/node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js not supported. 

Instead change the require of index.js in 

/data/prj/node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js to a dynamic 

import() which is available in all CommonJS modules. 

See "/tmp/ng-Fe4Op7/angular-errors.log" for further details. 





>SOLUTION


Avoid using --force argument with "npm audit" with this versions (detailed below under ENV topic) until the bug is fixed.

Use just: 

npm audit fix


>ENV

Windows 10

Angular CLI: 13.1.2

Node: 16.13.1

Package Manager: npm 8.1.2

OS: win32 x64


Saturday, January 8, 2022

maven: Error: Could not find or load main class...Caused by: java.lang.ClassNotFoundException:...

 

>PROBLEM


Attempt to run a mvn command, for instance:

  mvn -version

  

Returns:

  <!--Could not find or load main class ...

  Caused by: java.lang.ClassNotFoundException: ...-->



>SOLUTION


Check your envvars (environment variables).

The configuration shall be something like this:


M2_HOME = C:\apache-maven

MAVEN_OPTS=-Xms256m -Xmx512m

Path=%Path%;%M2_HOME%\bin


For some mistake, you may have a misconfiguration. For example:


***WRONG:

MAVEN_OPTS=-%M2_HOME%\bin



>ENV

Windows 10

apache-maven





@CTL: y;faq-Error: Could not find or load main class...Caused by: java.lang.ClassNotFoundException:<memo<maven;.

Tuesday, January 4, 2022

angular: Cannot parse arguments. See below for the reasons. Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean

 

>PROBLEM


Angular project fails starting and returns the following error message:


Cannot parse arguments. See below for the reasons.

Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean



>SOLUTION


It happens when a project using Windows encoding is deploy on *nix environment due the carriage return (CR) differences.

Convert the CRs to unix format.

There are many ways of doing that:


1. If using Git, when it is installed, during its install wizard, there are options to set automatically de CR format.


2. Free apps like SciTE, Notepad++, VSCode and etc. have encoding and CR converters.


>ENV

windows 10

angular



@CTL:
y;faq-Cannot parse arguments. See below for the reasons. Argument --ssl could not be parsed using value "true\r".Valid type(s) is: boolean<memo<angular;.

Monday, January 3, 2022

docker: angular service returns ERR_EMPTY_RESPONSE

 

>PROBLEM


Attempt to access an Angular project running from a docker fails, returning on the browser "ERR_EMPTY_RESPONSE".


>SOLUTION


Add --host argument to the "ng serve" command to start the service.


- before:

ng serve --port 4400 --ssl true


- after:

ng serve --port 4400 --ssl true --host 0.0.0.0

also tested OK with:
ng serve --port 4400 --ssl true --host=0.0.0.0


>ENV

windows 10
angular 16


>ref

tipsfordev.com/localhost-didn-t-send-data-err-empty-response-and-curl-52-empty-reply-from-server


@CTL:

y;faq-angular: ERR_EMPTY_RESPONSE<memo<docker;.

Sunday, January 2, 2022

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.

 

>PROBLEM


Attempt to map a volume fails retuning:


docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "-v": executable file not found in $PATH: unknown.


>SOLUTION


WRONG:

docker run -it --name extodo alsdias/express_todo -v C:\data:/home


RIGHT:

docker run -it --name extodo -v C:\data:/home alsdias/express_todo


>ENV

w10

docker


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...