Gradle : gradlew expecting in
Asked Answered
S

1

12

i am facing this issue

sparsh610@DESKTOP-551C51M:/mnt/e/xxxxxxxxx$ ./gradlew mm
: not found2: ./gradlew:
: not found8: ./gradlew:
./gradlew: 52: ./gradlew: Syntax error: word unexpected (expecting "in")

i verified that my system has gradle installed and with all the read write access.

any specific reason for this error ?

Already checked this link

Selfmade answered 25/3, 2019 at 16:58 Comment(2)
You should post your build.gradle file.Jeromyjerreed
It's a problem related to git and conversion between Windows and Unix endlines, see github.com/gradle/gradle/issues/2906Moen
O
19

Its simply a difference between UNIX and windows handling end of line character, so easy to solve just type sed -i.bak 's/\r$//' gradlew this will replace the carriage return. With the option -i, the file will be edited in-place, and the original file will be backed up as gradlew.bak

Octarchy answered 19/9, 2019 at 1:31 Comment(3)
... or just use Notepad++ to do a conversion, anyway - thanks so much!Boarhound
Can you elaborate more each syntax? It works for me but I have no idea why...Euphemie
I noticed that bash has some issues when lines terminate with \r\n instead of \n. Bash tries to interpret \r as a char belonging to the command, causing errors that are very difficult to understand.Foreground

© 2022 - 2024 — McMap. All rights reserved.