nimiq / core-js

Official JavaScript implementation of the Nimiq protocol
https://nimiq.com
Other
989 stars 207 forks source link

npm run build not working, error 137 #295

Closed bitcoinvsalts closed 6 years ago

bitcoinvsalts commented 6 years ago
$ npm run build

> nimiq@1.0.0 build /home/nimiq/core
> gulp build

[02:39:27] Using gulpfile ~/core/gulpfile.js
(node:12755) ExperimentalWarning: The http2 module is an experimental API.
[02:39:27] Starting 'build-worker'...
[02:39:27] Starting 'build-istanbul'...
[02:39:27] Starting 'build-loader'...
[02:39:27] Starting 'build-node'...
.[02:39:35] Finished 'build-worker' after 7.48 s
[02:39:35] Starting 'build-web'...
[02:39:35] Starting 'build-web-babel'...
.
Processed [150] files in 9 secs
The following 2 file(s) had errors and were copied as-is
[ { file: 'platform/browser/index.prefix.js',
    error: 'Unexpected token (24:0)' },
  { file: 'platform/browser/index.suffix.js',
    error: '\'return\' outside of function (3:4)' } ]
[02:39:37] Finished 'build-istanbul' after 10 s
[02:39:37] Starting 'build-web-istanbul'...
[02:39:38] Starting 'build-node-istanbul'...
[02:39:40] Finished 'build-loader' after 13 s
[02:39:45] Finished 'build-node' after 18 s
[BABEL] Note: The code generator has deoptimised the styling of "web.js" as it exceeds the max of "500KB".
Killed
npm ERR! code ELIFECYCLE
npm ERR! errno 137
npm ERR! nimiq@1.0.0 build: `gulp build`
npm ERR! Exit status 137
npm ERR!
npm ERR! Failed at the nimiq@1.0.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/nimiq/.npm/_logs/2017-12-31T02_39_53_292Z-debug.log

$ npm --version
5.5.1
nimiq@patience:~/core$ node --version
v9.3.0

any idea why?

manuel-sejourne commented 6 years ago

Have the same issue ?

jeffesquivels commented 6 years ago

@manuel-sejourne Do you also see the Killed message in the logs? Can you post the complete logs? Which operating system and version are you using?

manuel-sejourne commented 6 years ago

yes I saw "killed". What is this ?

manuel-sejourne commented 6 years ago

img_20180411_181019

darnux commented 6 years ago

This usually happens if OOM killer (https://linux-mm.org/OOM_Killer) ends a process due to RAM shortage. Can you post the output of free -m before running the build. I would suggest to have at least 512M RAM available when building the node.

Manuel Séjourné notifications@github.com schrieb am Mi., 11. Apr. 2018, 23:54:

[image: img_20180411_181019] https://user-images.githubusercontent.com/1440791/38645186-7403eae2-3de3-11e8-8848-1cbb229ecd0d.jpg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nimiq-network/core/issues/295#issuecomment-380607935, or mute the thread https://github.com/notifications/unsubscribe-auth/ARGCJRPV8mzWZTL5nXtwQ7LiOdIgjdcjks5tnnt3gaJpZM4RPwKp .

manuel-sejourne commented 6 years ago

Ok I will try this. I test with yarn and Is is ok

riptl commented 6 years ago

You can limit Node's heap space so the Linux OOM killer never kicks in.

node --max-old-space-size=512 node_modules/gulp/bin/gulp.js build (The yarn build step of the README with max 512MB RAM)

But sometimes 512MB is still not enough, Node will throw an OOM exception.

abhilashkumar002 commented 5 years ago

Restart your system and try again. It worked for me.

Rajkumar55 commented 4 years ago

It is because of RAM shortage. Stop few running processes and try again. This worked for me

ZQ-jhon commented 4 years ago

try restart my server, resolved it, thanks for helpful information. and there is some infomation helpful https://github.com/nestjs/typescript-starter/commit/7f2dde2d6c5335306ec559195fb0e634edd5c314 good luck!

jdmarshall commented 3 years ago

I was hitting this issue with a Docker image (Docker desktop is very conservative about memory by default)

I just upped the resource limit, but if you are limited by VPS size or some other constraint you might also try:

NODE_OPTIONS=--optimize_for_size npm ci

AlexandarVysotskiy commented 2 years ago

This helped me https://stackoverflow.com/a/65533397/12073621