Travis can not execute existing script, saying not exist

Why travis can not execute scripts? saying can not find it, but it is there

https://travis-ci.com/wikiwang1991/nexus/builds/125376803

I added a ls -l command just before the execute command, which shows the script is there and executable

I can only imagine there is no /bin/sh, as your shebang expects.

@tanzislam is likely right that it’s not the script that’s not found, it’s something inside the script that fails.

I see that before_install.sh has emdebbed Windows line endings. So it’s likely that the file that’s “not found” is “/bin/sh\r”.

2 Likes

Indeed, you need to remove the CR characters from your script.

travis@5caee4fc493d:~$ curl -sSfLO https://raw.githubusercontent.com/wikiwang1991/nexus/442bb52e67d2ca79ae185dbaaab926ea8c82c1eb/before_install.sh
travis@5caee4fc493d:~$ ./before_install.sh
-su: ./before_install.sh: /bin/sh^M: bad interpreter: No such file or directory
travis@5caee4fc493d:~$ od -Xc before_install.sh
0000000        622f2123        732f6e69        0d0a0d68        7470610a
          #   !   /   b   i   n   /   s   h  \r  \n  \r  \n   a   p   t
0000020        736e6920        6c6c6174        71792d20        6e2d2d20
              i   n   s   t   a   l   l       -   y   q       -   -   n
0000040        6e692d6f        6c617473        75732d6c        73656767
          o   -   i   n   s   t   a   l   l   -   s   u   g   g   e   s
0000060        2d207374        2d6f6e2d        74736e69        2d6c6c61
          t   s       -   -   n   o   -   i   n   s   t   a   l   l   -
0000100        6f636572        6e656d6d        5c207364        6c630a0d
          r   e   c   o   m   m   e   n   d   s       \  \r  \n   c   l
0000120        20676e61        6a6e696e        75622d61        20646c69
          a   n   g       n   i   n   j   a   -   b   u   i   l   d
0000140        6762696c        67616c66        65642d73        696c2076
          l   i   b   g   f   l   a   g   s   -   d   e   v       l   i
0000160        62627462        7665642d        62696c20        756f7361
          b   t   b   b   -   d   e   v       l   i   b   a   s   o   u
0000200        2d32646e        20766564        7362696c        642d6c73
          n   d   2   -   d   e   v       l   i   b   s   s   l   -   d
0000220        6c207665        76616269        6d726f66        642d7461
          e   v       l   i   b   a   v   f   o   r   m   a   t   -   d
0000240        7a207665        3162696c        65642d67        000a0d76
          e   v       z   l   i   b   1   g   -   d   e   v  \r  \n
0000257
2 Likes

Thanks everyone. I’m going to get me real linux environment :stuck_out_tongue: