Skip to content

Difficulties when using from Windows WSL2 Unbuntu #33

@AMorgaut

Description

@AMorgaut

Configuration

  • Windows 11
  • Ubuntu 22.04 LTS in WSL2
  • Github for Windows
  • VSCode (launched via $ code . from the repo root folder)

Steps

Because having diffuculties with my ssh keys from Ubuntu, from https://github.com/green-code-initiative/ecoCode-common I clicked on the "Code" button and selected the "Open with Github Desktop" option
image
It handles Github MFA

From Github Desktop I selected a folder in my WSL2 filesystem
image

From the WSL2 Ubuntu, I went to the ecocode-common folder and launched VSCode

cd ecocode-common
code .

Then I opened the bash terminal from VSCode to do any required command line actions
(like I'm used to when using git or npm command on a project)

Faced issues

File execution property

When trying to execute check_requirements.sh the autocomplete didn't work

./tools/check_requirements/ #no autocompletion here

I quickly uderstood I had to call chmod to make it executable

chmod +x ./tools/check_requirements/check_requirements.sh

and did the same thing to _core.sh

Bad interpreter

Now that I could run it

./tools/check_requirements/check_requirements.sh

I got a strange issue

bash: ./tools/check_requirements/check_requirements.sh: /bin/bash^M: bad interpreter: No such file or directory

It turned out that the file was in CRLF, idem for _core.sh and all the files
It looks like potentially the Github Desktop turned the files into CRLF
Note that CRLF might be ok for the .bat windows file

I tried to initiate an .editorconfig file
ex:

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Windows-style newlines for bat files
[*.bat]
end_of_line = crlf

but it may have to be also defined at a git config level

No such file or directory

Now that I was fixed I runned it again

./tools/check_requirements/check_requirements.sh

I got a _core.sh: No such file or directory error
It turned out that I had to go first in the script folder to hav it running

cd tools/check_requirements/
./check_requirements.sh

javap: command not found

I did install Java 11 as I saw it required

$ java --version
openjdk 17.0.10 2024-01-16

but apparently my Java was not complete, What is this javac ?
( I'm a JavaScript developer sorry ;-) )

So I've been told to install the whole SDK coming with

sudo apt install openjdk-11-jdk

Syntax error: invalid arithmetic operator

Once the JDK is installed (Hourra)
A new error came out

***** Java 🚀
   ✅ installation
")syntax error: invalid arithmetic operator (error token is "
   ❌ min version : please check or install good version 
        (current class version : 55)
')/ min jdk version : '11n : '55
")syntax error: invalid arithmetic operator (error token is "
   ❌ max version : please check or install good version 
        (current class version : 55)
')/ max jdk version : '17n : '61

I was not able to fix that one

Maven check display error

A related error apperently also happened when checking the Maven version

***** Maven 🚀
   ✅ installation
   ✅ min version
')      (current version : 3.6.3 / min version : '3.5.2
   ✅ max version
')      (current version : 3.6.3 / max version : '3.9.6

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions