Vue+Dockerの起動時のエラー

###解決策はこちら
####store/index.jsを作成
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/668402/442bcd1c-cd36-bc0d-3d85-81666fce8e46.png)

####FROM node:16-alpineにDockerfileを変更
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/668402/7a16947b-c225-78a6-0aa0-a8c4b44bfb0c.png)


※すでに上記を試している方には以下の内容はお役に立ちません＼(^o^)／

###環境

OS: Windows10

```:dockerバージョン
$ docker version
Client:
 Cloud integration: 1.0.17
 Version:           20.10.7
 API version:       1.41
 Go version:        go1.16.4
 Git commit:        f0df350
 Built:             Wed Jun  2 12:00:56 2021   
 OS/Arch:           windows/amd64
 Context:           desktop-linux
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.7
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       b0f5bc3
  Built:            Wed Jun  2 11:54:58 2021   
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.6
  GitCommit:        d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc:
  Version:          1.0.0-rc95
  GitCommit:        b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
```

```:docker実行環境
$ docker info
Client:
 Context:    desktop-linux
 Debug Mode: false
 Plugins:
  buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
  compose: Docker Compose (Docker Inc., 2.0.0-beta.4)
  scan: Docker Scan (Docker Inc., v0.8.0)

Server:
 Containers: 7
  Running: 0
  Paused: 0
  Stopped: 7
 Images: 23
 Server Version: 20.10.7
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: d71fcd7d8303cbf684402823e425e9dd2e99285d
 runc version: b9ee9c6314599f1b4a7f497e1f1f856fe433d3b7
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.4.72-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 12.41GiB
 Name: docker-desktop
 ID: U5EO:VW5G:DOLH:VZGT:A6DE:CBPZ:VX4M:BTYW:BU5I:OOWJ:Z5UD:VNPE
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
```

```:nodeとyarnバージョン
$ node -v
v14.18.1

$ yarn -v
1.22.15
```

###発生したエラー
####store/index.jsがない

```console:Docker起動時
$ docker compose up --build

...(略)
nuxt_1  | yarn run v1.22.15
nuxt_1  | $ nuxt
...（略）
nuxt_1  |  FATAL  Enable vuex store by creating store/index.js.
nuxt_1  |
nuxt_1  |
nuxt_1  |    ╭─────────────────────────────────────────────────────╮
nuxt_1  |    │                                                     │
nuxt_1  |    │   ✖ Nuxt Fatal Error                                │
nuxt_1  |    │                                                     │
nuxt_1  |    │   Enable vuex store by creating `store/index.js`.   │
nuxt_1  |    │                                                     │
nuxt_1  |    ╰─────────────────────────────────────────────────────╯
nuxt_1  |
nuxt_1  | error Command failed with exit code 1.
nuxt_1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
nuxt_1 exited with code 1
```

storeディレクトリ配下にindex.jsという名前のファイルを作る必要があるという意味。詳しくはわかっていませんが、保管用のディレクトリなのかしら？？

とりあえず起動には必要みたいなので、作成し再度実行します。（中身は空でOK）


####ハッシュ関数のエラー！？

```console:
...
nuxt_1  | node:internal/crypto/hash:67
nuxt_1  |   this[kHandle] = new _Hash(algorithm, xofLen);
...
nuxt_1  | Error: error:0308010C:digital envelope routines::unsupported
nuxt_1  |     at new Hash (node:internal/crypto/hash:67:19)
nuxt_1  |     at Object.createHash (node:crypto:130:10)
...
nuxt_1  |   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
nuxt_1  |   library: 'digital envelope routines',
nuxt_1  |   reason: 'unsupported',
nuxt_1  |   code: 'ERR_OSSL_EVP_UNSUPPORTED'
nuxt_1  | }
nuxt_1  |
nuxt_1  | Node.js v17.2.0
nuxt_1  | error Command failed with exit code 1.
nuxt_1  | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
nuxt_1 exited with code 1

```


いろいろ調べたけど、結局Node.jsのバージョンによるエラーっぽいです。
17にはバグがあるから16のバージョンにする必要があるようです。

Dockerfileを編集して、nodeのバージョンを16に指定します。

###Dockerfileを編集してnode16をインストールするように変更

```Dockerfile:dockerfile
#ここで16を指定。もともとnode:alpineでした（最新版を持ってくる？）
FROM node:16-alpine

EXPOSE 3000
ENV HOST 0.0.0.0

RUN apk update && \
  apk add git vim && \
  yarn global add @vue/cli nuxt create-nuxt-app

```

これで再度起動

```console
$ docker compose up --build
...
nuxt_1  | ℹ Listening on: http://172.20.0.2:3000/
nuxt_1  | ℹ Preparing project for development
nuxt_1  | ℹ Initial build may take a while
nuxt_1  | ℹ Discovered Components: .nuxt/components/readme.md
nuxt_1  | ✔ Builder initialized
nuxt_1  | ✔ Nuxt files generated
nuxt_1  | ℹ Compiling Client
nuxt_1  | ℹ Compiling Server
nuxt_1  | ✔ Server: Compiled successfully in 32.01s
nuxt_1  | ✔ Client: Compiled successfully in 36.59s
nuxt_1  | ℹ Waiting for file changes
nuxt_1  | ℹ Memory usage: 407 MB (RSS: 521 MB)
nuxt_1  | ℹ Listening on: http://172.20.0.2:3000/
nuxt_1  | No issues found.

```

問題なく終了しているので、これでlocalhost:3000でアクセスすることで画面が起動できるようになった！！ばんざーい＼(^o^)／