OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Failing the npm run build with exit status 137 in react with vite

  • Thread starter Thread starter Archan Bhalani
  • Start date Start date
A

Archan Bhalani

Guest
vite build --out-dir build

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details. vite v5.2.13 building for production... transforming...

✓ 5152 modules transformed. rendering chunks... /codebuild/output/tmp/script.sh: line 4: 178 Killed
npm run build [Container] 2024/06/26 11:34:48.511277 Command did not exit successfully npm run build exit status 137 [Container] 2024/06/26 11:34:48.574011 Phase complete: BUILD State: FAILED [Container] 2024/06/26 11:34:48.574038 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run build. Reason: exit status 137

I have tried to increase the memory size using NODE_OPTIONS='--max-old-space-size=2048'.

when i try to build it local I am not getting any error, when I build in AWS I am getting the above error.

this is my vite.config for build

Code:
build: {
        chunkSizeWarningLimit: 40000,
        //minify: false,
        sourcemap: true,
        rollupOptions: {
            onLog(level, log, handler) {
                if (log.cause && log.cause.message === `Can't resolve original location of error.`) {
                    return;
                }
                handler(level, log);
            },
        },
    },

and this is the build script using locally

"build": "cross-env NODE_OPTIONS='--max-old-space-size=2048' vite build --out-dir build",
<blockquote>
<p>vite build --out-dir build</p>
<p>The CJS build of Vite's Node API is deprecated. See
<a href="https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated" rel="nofollow noreferrer">https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated</a>
for more details. vite v5.2.13 building for production...
transforming...</p>
<p>✓ 5152 modules transformed. rendering chunks...
/codebuild/output/tmp/script.sh: line 4: 178 Killed<br />
npm run build [Container] 2024/06/26 11:34:48.511277 Command did not
exit successfully npm run build exit status 137 [Container] 2024/06/26
11:34:48.574011 Phase complete: BUILD State: FAILED [Container]
2024/06/26 11:34:48.574038 Phase context status code:
COMMAND_EXECUTION_ERROR Message: Error while executing command: npm
run build. Reason: exit status 137</p>
</blockquote>
<p>I have tried to increase the memory size using NODE_OPTIONS='--max-old-space-size=2048'.</p>
<p>when i try to build it local I am not getting any error, when I build in AWS I am getting the above error.</p>
<p>this is my vite.config for build</p>
<pre><code>build: {
chunkSizeWarningLimit: 40000,
//minify: false,
sourcemap: true,
rollupOptions: {
onLog(level, log, handler) {
if (log.cause && log.cause.message === `Can't resolve original location of error.`) {
return;
}
handler(level, log);
},
},
},
</code></pre>
<p>and this is the build script using locally</p>
<blockquote>
<p>"build": "cross-env NODE_OPTIONS='--max-old-space-size=2048' vite build --out-dir build",</p>
</blockquote>
Continue reading...
 
Top