LoginSignup
2
3

More than 5 years have passed since last update.

Windowsでcodeceptionをbuildする際は改行コードに注意

Last updated at Posted at 2018-02-02

問題

buildで

EC-CUBEのcodeceptionをWindowsでbuildすると以下のようなエラーが発生した。

$ sudo docker-compose -f docker-compose.yml -f docker-compose.chrome.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml build --pull --no-cache
mailcatcher uses an image, skipping
db uses an image, skipping
Building eccube3
Step 1/28 : FROM eccube/php-ext-apache
latest: Pulling from eccube/php-ext-apache
.
.
.
Step 17/28 : ADD clone-${DIRTYPE}.sh /clone.sh
 ---> 7a670b8c8cb4
Step 18/28 : RUN /clone.sh
 ---> Running in 2cf290854ce7
/bin/sh: 1: /clone.sh: Permission denied
ERROR: Service 'eccube3' failed to build: The command '/bin/sh -c /clone.sh' returned a non-zero code: 126

runで

また、EC-CUBEのcodeceptionをWindowsでrunすると以下のようなエラーが発生した。

$ docker-compose -f docker-compose.yml -f docker-compose.chrome.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml run --rm codecept run -d --env chrome,pgsql --coverage --coverage-html --coverage-xml --html report.html acceptance EF02ProductCest
Creating eccubecodeceptionlocal_mailcatcher_1
Creating eccubecodeceptionlocal_db_1
Creating eccubecodeceptionlocal_browser_1
Creating eccubecodeceptionlocal_eccube3_1
No such file or directory

No such file or directory 以外情報がなく困ってしまった。

原因

改行コードがCRLFになっていると実行できなくなるファイルがあるようです。

解決

windowsのgitが勝手に改行コードを変えてしまっていたので設定を変えます。

$ git config --global -l | grep core.autocrlf
core.autocrlf=true

$ git config --global core.autocrlf false

$ git config --global -l | grep core.autocrlf
core.autocrlf=false

もう一度リポジトリをcloneしましょう。

ソース自体がCRLFになってしまっていた場合は改行コードを置換してしまいましょう。

find . -name \*.sh -type f | xargs -n 10 nkf -Lu --overwrite

こちらを参考にさせていただきました。

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3