我正在尝试对接一个反应应用程序。因为我使用的是tailwindcss,所以它使用craco进行构建。它一直正常工作,直到今天构建开始为 CSS 文件抛出错误。
错误
> [admin-build 7/7] RUN npm run build:
#15 1.594
#15 1.594 > admin@0.1.0 build /app
#15 1.594 > craco build
#15 1.594
#15 3.555 craco: *** Cannot find ESLint loader (eslint-loader). ***
#15 3.873 Creating an optimized production build...
#15 89.72 Failed to compile.
#15 89.72
#15 89.72 ./src/styles/index.css
#15 89.72 TypeError: Cannot convert undefined or null to object
#15 89.72 at Function.entries (<anonymous>)
#15 89.72 at Array.forEach (<anonymous>)
#15 89.72
#15 89.72
#15 89.75 npm ERR! code ELIFECYCLE
#15 89.75 npm ERR! errno 1
#15 89.76 npm ERR! admin@0.1.0 build: `craco build`
#15 89.76 npm ERR! Exit status 1
#15 89.76 npm ERR!
#15 89.76 npm ERR! Failed at the admin@0.1.0 build script.
#15 89.76 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#15 89.76
#15 89.76 npm ERR! A complete log of this run can be found in:
#15 89.76 npm ERR! /root/.npm/_logs/2021-06-26T14_32_59_262Z-debug.log
------
我的 Dockerfile
# base image
FROM node:14-alpine as admin-build
# workdir
RUN mkdir /app
WORKDIR /app
# Install dependencies
COPY package.json ./
RUN npm install
# copy source
COPY . .
# build source
RUN npm run build
# Nginx for serving
FROM nginx:alpine
# copy configs
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=admin-build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
该应用程序在 docker 外部正确构建。有什么办法可以解决这个问题,或者至少看看问题是什么?
谢谢