Я пытался создать приложение реагирования Gitlab CI
, но оно продолжает работать на RUN npm run build
(пробовал RUN CI=true npm run build
тоже) при попытке создать файл Docker.
Вот мой Dockerfile
FROM node:8.11.1
# Create app directory
WORKDIR /app/
# Install app dependencies
RUN npm -g install serve
# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json /app/
RUN npm install
# Bundle app source
COPY . /app/
RUN ls /app/
#Build react/vue/angular bundle static files
RUN npm run build
EXPOSE 5000
# serve build folder on port 5000
CMD ["serve", "-s", "build", "-p", "5000"]
терпит неудачу на шаге RUN npm run build
со следующей ошибкой:
Step 8/10 : RUN npm run build
---> Running in d4b3bc5de229
> payed-fe@0.1.0 build /app
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/index.js
Cannot find file './app' in './src'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! payed-fe@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the payed-fe@0.1.0 build 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/2018-12-20T15_52_14_979Z-debug.log
The command '/bin/sh -c npm run build' returned a non-zero code: 1
ERROR: Job failed: exit code 1
Однако на моей локальной машине все работает как чудо (запуск npm, запуск npm, даже тот же Dockerfile на моемлокально строит успешно).Заранее спасибо!
--- РЕДАКТИРОВАТЬ 1 --- да ls
дает те же выходные данные в моей локальной системе и CI../src/index.js
это просто мой входной файл.Вот содержимое:
import React from "react";
import ReactDOM from "react-dom";
import App from "./app";
import * as serviceWorker from "./serviceWorker";
ReactDOM.render(<App />, document.getElementById("root"));
serviceWorker.unregister();
И да, пути в порядке, так как он успешно работает на моей локальной машине.
--- EDIT 2 ---
Вывод /root/.npm/_logs/*.log
после того, как я изменил рабочий каталог на /payed
- Все еще не повезло!
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm@5.6.0
3 info using node@v8.11.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle payed-fe@0.1.0~prebuild: payed-fe@0.1.0
6 info lifecycle payed-fe@0.1.0~build: payed-fe@0.1.0
7 verbose lifecycle payed-fe@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle payed-fe@0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/payed/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle payed-fe@0.1.0~build: CWD: /payed
10 silly lifecycle payed-fe@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle payed-fe@0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle payed-fe@0.1.0~build: Failed to exec build script
13 verbose stack Error: payed-fe@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid payed-fe@0.1.0
15 verbose cwd /payed
16 verbose Linux 4.14.48-coreos-r2
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
18 verbose node v8.11.1
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error payed-fe@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the payed-fe@0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]