npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm run build - npm ERR! code ELIFECYCLE


I have a react app that is working fine when I run it with npm start but when I try to build it with npm run build it gives this error:

This is what I see:
$ npm run build

> reactsearch@0.1.0 build /home/ppdevts4/public_html/reactsearch
> react-scripts build

npm ERR! errno 1
npm ERR! reactsearch@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactsearch@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!     /home/ppdevts4/.npm/_logs/2019-10-12T10_38_05_377Z-debug.log

This is the debug.log file:

0 info it worked if it ends with ok
1 verbose cli [ '/home/ppdevts4/bin/node', '/home/ppdevts4/bin/npm', 'run', 'build' ]
2 info using npm@6.12.0
3 info using node@v12.9.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle reactsearch@0.1.0~prebuild: reactsearch@0.1.0
6 info lifecycle reactsearch@0.1.0~build: reactsearch@0.1.0
7 verbose lifecycle reactsearch@0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle reactsearch@0.1.0~build: PATH: /home/ppdevts4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ppdevts4/public_html/reactsearch/node_modules/.bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/ppdevts4/.local/bin:/home/ppdevts4/bin
9 verbose lifecycle reactsearch@0.1.0~build: CWD: /home/ppdevts4/public_html/reactsearch
10 silly lifecycle reactsearch@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle reactsearch@0.1.0~build: Returned: code: 1  signal: null
12 info lifecycle reactsearch@0.1.0~build: Failed to exec build script
13 verbose stack Error: reactsearch@0.1.0 build: `react-scripts build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/ppdevts4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:209:13)
13 verbose stack     at ChildProcess.<anonymous> (/home/ppdevts4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:209:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid reactsearch@0.1.0
15 verbose cwd /home/ppdevts4/public_html/reactsearch
16 verbose Linux 3.10.0-962.3.2.lve1.5.25.10.el7.x86_64
17 verbose argv "/home/ppdevts4/bin/node" "/home/ppdevts4/bin/npm" "run" "build"
18 verbose node v12.9.1
19 verbose npm  v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error reactsearch@0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the reactsearch@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 ]

Other forum posts seem to indicate that this error could mean the server does not have enough memory so I ran it on a t3.2 AWS instance with 8CPUs and 32GB Ram and it gives the same error.

I’m new to node and this is my first attempt to build a project. Any ideas how I can get this build to work?

Many thanks,