在 Docker Desktop 上运行图像/容器时不断出现错误 /usr/app/node_modules/.bin/../node/bin/node: 1: This: not find

问题描述 投票:0回答:1

我正在尝试使用 Docker Desktop 在 Windows 11 中的 VSCode 上 Dockerize MERN 堆栈。 docker-compose 正确构建后端、前端和 mongodb 镜像。但是,每当我尝试在 Docker Desktop 上运行前端和后端映像时,它都会以代码 127 退出。我的猜测是我在 Dockerfile 中使用的节点版本,但我尝试过使用 Node:latest 和 Node:21。它抛出的错误是 /usr/app/node_modules/.bin/../node/bin/node: 1: This: not find.

前端的 Dockerfile: 我当前的前端 Dockerfile 使用的是 node:latest

服务器的 Dockerfile: 服务器 Dockerfile

docker-compose.yml: docker-compose 文件

Docker 桌面上的结果:Docker 桌面上的输出

我的 package.json 文件夹正在使用最新版本的节点(21.x.x)

尝试在 Docker 镜像中运行 MERN Stack。

docker-compose dockerfile mern
1个回答
0
投票

@Pranav Rao 你解决这个问题了吗? 我也有类似的问题,我的问题是here

© www.soinside.com 2019 - 2024. All rights reserved.