在使用纱线 Docker 的 Reactjs 中,"install\r" 错误意味着什么?
What does "install\r" error mean in Reactjs with Docker using yarn?
我使用 Docker 设置创建了一个 Reactjs 应用程序。我正在使用 Windows 10。构建后,容器不断重启,在日志中产生错误:
Docker Image
Logs Image
Browser Image
yarn run v1.22.5
error Command "install\r" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
: not foundotup.sh: line 3:
/var/www/bootup.sh: line 11: syntax error: unexpected end of file (expecting "then")
Docker文件
# pull official base image
FROM node:12.20.0-alpine3.10
WORKDIR /var/www
COPY package.json /var/www/
RUN yarn install
COPY . /var/www/
# Install create-react-app package
RUN yarn global add react-scripts
EXPOSE 3000
ADD ./bootup.sh /var/www
RUN cd /var/www
RUN chmod +x /var/www/bootup.sh
docker-compose.yml
version: '3.7'
services:
frontend:
build: .
restart: unless-stopped
tty: true
working_dir: /var/www/
ports:
- '3002:3000'
volumes:
- '.:/var/www'
- /var/www/node_modules
environment:
- CHOKIDAR_USEPOLLING=true yarn start
command: /var/www/bootup.sh ${SSL_ON}
bootup.sh
# Install Dependencies
yarn install
# Start the react app
if [ "" == "true" ]
then
yarn start-https
else
yarn start
fi
我尝试重新启动它,杀死容器,再次克隆存储库,但问题仍然存在。
我使用另一台笔记本电脑在 Ubuntu 中克隆了存储库,none 这些错误仅在 windows 上发生。如果有人知道这意味着什么,那将是一个很大的帮助。
我根据@HansKilian 关于行尾的评论解决了这个问题。我按照 link 了解如何使用正确的 UNIX 样式行结尾转换 bootup.sh
文件:https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings
我使用 Docker 设置创建了一个 Reactjs 应用程序。我正在使用 Windows 10。构建后,容器不断重启,在日志中产生错误:
Docker Image
Logs Image
Browser Image
yarn run v1.22.5
error Command "install\r" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
: not foundotup.sh: line 3:
/var/www/bootup.sh: line 11: syntax error: unexpected end of file (expecting "then")
Docker文件
# pull official base image
FROM node:12.20.0-alpine3.10
WORKDIR /var/www
COPY package.json /var/www/
RUN yarn install
COPY . /var/www/
# Install create-react-app package
RUN yarn global add react-scripts
EXPOSE 3000
ADD ./bootup.sh /var/www
RUN cd /var/www
RUN chmod +x /var/www/bootup.sh
docker-compose.yml
version: '3.7'
services:
frontend:
build: .
restart: unless-stopped
tty: true
working_dir: /var/www/
ports:
- '3002:3000'
volumes:
- '.:/var/www'
- /var/www/node_modules
environment:
- CHOKIDAR_USEPOLLING=true yarn start
command: /var/www/bootup.sh ${SSL_ON}
bootup.sh
# Install Dependencies
yarn install
# Start the react app
if [ "" == "true" ]
then
yarn start-https
else
yarn start
fi
我尝试重新启动它,杀死容器,再次克隆存储库,但问题仍然存在。
我使用另一台笔记本电脑在 Ubuntu 中克隆了存储库,none 这些错误仅在 windows 上发生。如果有人知道这意味着什么,那将是一个很大的帮助。
我根据@HansKilian 关于行尾的评论解决了这个问题。我按照 link 了解如何使用正确的 UNIX 样式行结尾转换 bootup.sh
文件:https://support.nesi.org.nz/hc/en-gb/articles/218032857-Converting-from-Windows-style-to-UNIX-style-line-endings