github 操作 npm run build 不工作,但在本地工作

syd*_*dgm 5 npm docker reactjs github-actions

我们的团队创建了一个 React Web 应用程序,并希望使用 github Action 将项目推送到 Kubernetes。这是 Dockerfile:

### STAGE 1: Build ###
FROM node:14.5.0 as build

RUN mkdir -p /src/app
WORKDIR /src/app

# Install app dependencies
COPY package.json /src/app/
RUN npm install && \
    npm install -g pushstate-server

# Bundle app source
COPY . /src/app

# Build and optimize react app
RUN npm run build:staging

### STAGE 2: Production Environment ###
FROM nginx:1.19.2
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Run Code Online (Sandbox Code Playgroud)

当我使用命令在本地运行 docker 时

docker build --tag abc:test .
Run Code Online (Sandbox Code Playgroud)

它成功构建了图像。但是当我将其推送到 github 操作时,它会停止在RUN npm run build:staging. 错误消息是

/src/app/src/Components/SideBar/SideBarLinks/index.tsx
TypeScript error in /src/app/src/Components/SideBar/SideBarLinks/index.tsx(124,9):
Property 'children' is missing in type '*** onEntered: () => void; ***' but required in type 'CollapseProps'.  TS2741

    122 |         dropdownWrapperProps=*** 'data-tour': 'support-wrapper' ***
    123 |         dropdownToggleProps=*** 'data-tour': 'support-dropdown-button' ***
  > 124 |         collapseProps=***
        |         ^
    125 |           onEntered: () => ***
    126 |             const sidebarItemsWrapper = document.querySelector(
    127 |               '.side-bar-items-wrapper'

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-21T06_19_14_044Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo@4.0.0 api:staging: `cross-env REACT_APP_API_BASE_URL=https://staging.jetsonai.com/api/v3 npm run integrations-url:staging "npm" "run" "build"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dashboard_redo@4.0.0 api:staging script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-21T06_19_14_076Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dashboard_redo@4.0.0 build:staging: `cross-env REACT_APP_MODE=test npm run api:staging npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the dashboard_redo@4.0.0 build:staging script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-09-21T06_19_14_093Z-debug.log
The command '/bin/sh -c npm run build:staging' returned a non-zero code: 1

##[error]Process completed with exit code 1.
Run Code Online (Sandbox Code Playgroud)

任何想法?