ELIFECYCLE npm run-script build

What I Wanted to Do

> npm run-script build

What Happened Instead

/usr/src/.../setup # npm run-script build

> setup@0.1.0 build /usr/src/.../setup
> react-scripts build

Creating an optimized production build...
The build failed because the process exited too early. This probably means the system ran out of memory or someone called `kill -9` on the process.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! setup@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the setup@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/2019-01-17T20_28_47_563Z-debug.log

Here is the log file:

# cat /root/.npm/_logs/2019-01-17T20_28_47_563Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run-script', 'build' ]
2 info using npm@6.4.1
3 info using node@v8.14.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle setup@0.1.0~prebuild: setup@0.1.0
6 info lifecycle setup@0.1.0~build: setup@0.1.0
7 verbose lifecycle setup@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle setup@0.1.0~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/src/.../setup/node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle setup@0.1.0~build: CWD: /usr/src/.../setup
10 silly lifecycle setup@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle setup@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle setup@0.1.0~build: Failed to exec build script
13 verbose stack Error: setup@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301: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/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:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid setup@0.1.0
15 verbose cwd /usr/src/.../setup
16 verbose Linux 3.10.0-957.1.3.el7.x86_64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run-script" "build"
18 verbose node v8.14.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error setup@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the setup@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 ]

Details

I get this error when I try to run this command in a Docker container. It works fine outside the Docker container. It also works fine in a Docker container on a different machine (using the same Docker version and setup).

Platform Info

$ npm --versions
{ setup: '0.1.0',
  npm: '6.4.1',
  ares: '1.14.0',
  cldr: '32.0',
  http_parser: '2.8.1',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.33.0',
  node: '8.14.0',
  openssl: '1.0.2q',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.20.2',
  v8: '6.2.414.72',
  zlib: '1.2.11' }
$ node -p process.platform
linux

This is an issue with the script itself. See the above section of the error log.

Which section exactly are you referring to? Thanks!

This section right before the actual error message from npm.

I see. I don’t think it is a memory issue and no one called kill. So, it is a bit of a mystery why it works on one environment and not the other. I think it is a bug, or, at least, a poorly documented error.

I still run into this once in a while. I wonder if there is a way to truck it down. It is not always happening.

Hello,
today i run also in this problem.
after trying to run a vue-js-cli application.
Have the same Errors and no way to solve it.
It is just a blain blank app, means it hast to work like a charm.

npm 6.9.0
Nodejs 10.15.2
OS: Parrot Sec Kernel 4.9

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'serve' ]
2 info using npm@6.9.0
3 info using node@v10.15.2
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle vue-cms@0.1.0~preserve: vue-cms@0.1.0
6 info lifecycle vue-cms@0.1.0~serve: vue-cms@0.1.0
7 verbose lifecycle vue-cms@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle vue-cms@0.1.0~serve: PATH: /usr/local/lib/node_modules/npm/node_module /npm-lifecycle/node-gyp-bin:/storage/web/cleancodestudio/vue-cms/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
9 verbose lifecycle vue-cms@0.1.0~serve: CWD: /storage/web/cleancodestudio/vue-cms
10 silly lifecycle vue-cms@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 silly lifecycle vue-cms@0.1.0~serve: Returned: code: 126  signal: null
12 info lifecycle vue-cms@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: vue-cms@0.1.0 serve: `vue-cli-service serve`

13 verbose stack Exit status 126
13 verbose stack at EventEmitter. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:970:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid vue-cms@0.1.0
15 verbose cwd /storage/web/cleancodestudio/vue-cms
16 verbose Linux 4.19.0-parrot4-28t-amd64
17 verbose argv “/usr/bin/node” “/usr/local/bin/npm” “run” “serve”
18 verbose node v10.15.2
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 126
22 error vue-cms@0.1.0 serve: vue-cli-service serve
22 error Exit status 126
23 error Failed at the vue-cms@0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

i was not able to run the script as default user nor as root.

Kind Regards,

mybe close your IDE vscode,try again npm start…