[SUMO] NPM package recipe Javascript heap out of memory
Bel Hadj Salem Talel <bhstalel@...>
Hi All,
I created a recipe that builds an NPM package, it worked well on the Zeus branch , but in another environment using Sumo branch this error occurred :
Log data follows
| DEBUG: Executing shell function do_compile
| npm WARN @ant-design/icons-react@2.0.1 requires a peer of @ant-design/icons@^2.0.0 but none is installed. You must install peer dependencies yourself.
| npm WARN connected-react-router@6.6.1 requires a peer of react-redux@^6.0.0 || ^7.1.0 but none is installed. You must install peer dependencies yourself.
| npm WARN draftjs-utils@0.10.2 requires a peer of draft-js@^0.11.x but none is installed. You must install peer dependencies yourself.
| npm WARN jsdom@....1 requires a peer of canvas@^2.5.0 but none is installed. You must install peer dependencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer of @types/googlemaps@^3.0.0 but none is installed. You must install peer dependencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer of @types/markerclustererplus@^2.1.29 but none is installed. You must install peer dependencies yourself.
| npm WARN react-instantsearch-native@5.7.0 requires a peer of react-native@>= 0.32.0 but none is installed. You must install peer dependencies yourself.
| npm WARN slick-carousel@1.8.1 requires a peer of jquery@>=1.8.0 but none is installed. You must install peer dependencies yourself.
| npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
| npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
| npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
| npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
| npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/chokidar/node_modules/fsevents):
| npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
|
| up to date in 12.739s
|
| > Sense@1.5.0 build /media/raach/abd909e5-d129-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-web/1.1.6-r0/git
| > react-app-rewired build
|
| Creating an optimized production build...
| Browserslist: caniuse-lite is outdated. Please run next command `npm update`
|
| <--- Last few GCs --->
|
| [26063:0x3639a50] 63259 ms: Mark-sweep 1404.3 (1487.5) -> 1404.4 (1487.5) MB, 686.5 / 0.0 ms allocation failure GC in old space requested
| [26063:0x3639a50] 63966 ms: Mark-sweep 1404.4 (1487.5) -> 1404.3 (1459.5) MB, 707.1 / 0.0 ms last resort GC in old space requested
| [26063:0x3639a50] 64673 ms: Mark-sweep 1404.3 (1459.5) -> 1404.3 (1459.5) MB, 705.9 / 0.0 ms last resort GC in old space requested
|
|
| <--- JS stacktrace --->
|
| ==== JS stack trace =========================================
|
| Security context: 0x1e195c298ed1 <JSObject>
| 1: push(this=0x29586960fcc1 <JSArray[386408]>)
| 2: /* anonymous */(aka /* anonymous */) [/media/raach/abd909e5-d129-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-web/1.1.6-r0/git/node_modules/webpack-sources/lib/applySourceMap.js:~58] [pc=0x1edb749f50fe](this=0x1e195c282241 <undefined>,chunk=0x245a6ac85169 <String[2]: e}>,middleMapping=0x7288a626e89 <Object map = ...
|
| FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
| 1: node::Abort() [node]
| 2: 0xf3343c [node]
| 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
| 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
| 5: v8::internal::Factory::NewUninitializedFixedArray(int) [node]
| 6: 0xb34a3b [node]
| 7: 0xb34c65 [node]
| 8: v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow) [node]
| 9: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
| 10: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
| 11: v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode) [node]
| 12: v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
| 13: 0x1edb73f840bd
| npm ERR! code ELIFECYCLE
| npm ERR! errno 1
| npm ERR! Sense@1.5.0 build: `react-app-rewired build`
| npm ERR! Exit status 1
| npm ERR!
| npm ERR! Failed at the Sense@1.5.0 build script.
| npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I compared the nodejs-native recipes versions , for sumo it's 8.9.4-r0 , and in Zeus it's 10.16.3-r0
Here is my recipe:
Is it a problem with old nodejs version ?
Any ideas?
Thanks, Talel
I created a recipe that builds an NPM package, it worked well on the Zeus branch , but in another environment using Sumo branch this error occurred :
Log data follows
| DEBUG: Executing shell function do_compile
| npm WARN @ant-design/icons-react@2.0.1 requires a peer of @ant-design/icons@^2.0.0 but none is installed. You must install peer dependencies yourself.
| npm WARN connected-react-router@6.6.1 requires a peer of react-redux@^6.0.0 || ^7.1.0 but none is installed. You must install peer dependencies yourself.
| npm WARN draftjs-utils@0.10.2 requires a peer of draft-js@^0.11.x but none is installed. You must install peer dependencies yourself.
| npm WARN jsdom@....1 requires a peer of canvas@^2.5.0 but none is installed. You must install peer dependencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer of @types/googlemaps@^3.0.0 but none is installed. You must install peer dependencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer of @types/markerclustererplus@^2.1.29 but none is installed. You must install peer dependencies yourself.
| npm WARN react-instantsearch-native@5.7.0 requires a peer of react-native@>= 0.32.0 but none is installed. You must install peer dependencies yourself.
| npm WARN slick-carousel@1.8.1 requires a peer of jquery@>=1.8.0 but none is installed. You must install peer dependencies yourself.
| npm WARN ws@7.2.1 requires a peer of bufferutil@^4.0.1 but none is installed. You must install peer dependencies yourself.
| npm WARN ws@7.2.1 requires a peer of utf-8-validate@^5.0.2 but none is installed. You must install peer dependencies yourself.
| npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
| npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
| npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/chokidar/node_modules/fsevents):
| npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
|
| up to date in 12.739s
|
| > Sense@1.5.0 build /media/raach/abd909e5-d129-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-web/1.1.6-r0/git
| > react-app-rewired build
|
| Creating an optimized production build...
| Browserslist: caniuse-lite is outdated. Please run next command `npm update`
|
| <--- Last few GCs --->
|
| [26063:0x3639a50] 63259 ms: Mark-sweep 1404.3 (1487.5) -> 1404.4 (1487.5) MB, 686.5 / 0.0 ms allocation failure GC in old space requested
| [26063:0x3639a50] 63966 ms: Mark-sweep 1404.4 (1487.5) -> 1404.3 (1459.5) MB, 707.1 / 0.0 ms last resort GC in old space requested
| [26063:0x3639a50] 64673 ms: Mark-sweep 1404.3 (1459.5) -> 1404.3 (1459.5) MB, 705.9 / 0.0 ms last resort GC in old space requested
|
|
| <--- JS stacktrace --->
|
| ==== JS stack trace =========================================
|
| Security context: 0x1e195c298ed1 <JSObject>
| 1: push(this=0x29586960fcc1 <JSArray[386408]>)
| 2: /* anonymous */(aka /* anonymous */) [/media/raach/abd909e5-d129-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-web/1.1.6-r0/git/node_modules/webpack-sources/lib/applySourceMap.js:~58] [pc=0x1edb749f50fe](this=0x1e195c282241 <undefined>,chunk=0x245a6ac85169 <String[2]: e}>,middleMapping=0x7288a626e89 <Object map = ...
|
| FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
| 1: node::Abort() [node]
| 2: 0xf3343c [node]
| 3: v8::Utils::ReportOOMFailure(char const*, bool) [node]
| 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
| 5: v8::internal::Factory::NewUninitializedFixedArray(int) [node]
| 6: 0xb34a3b [node]
| 7: 0xb34c65 [node]
| 8: v8::internal::JSObject::AddDataElement(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow) [node]
| 9: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
| 10: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8::internal::Object::StoreFromKeyed) [node]
| 11: v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::LanguageMode) [node]
| 12: v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::internal::Isolate*) [node]
| 13: 0x1edb73f840bd
| npm ERR! code ELIFECYCLE
| npm ERR! errno 1
| npm ERR! Sense@1.5.0 build: `react-app-rewired build`
| npm ERR! Exit status 1
| npm ERR!
| npm ERR! Failed at the Sense@1.5.0 build script.
| npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I compared the nodejs-native recipes versions , for sumo it's 8.9.4-r0 , and in Zeus it's 10.16.3-r0
Here is my recipe:
BRANCH = "master"
PROTOCOL = "http"
SRC_URI += "git://gitlab.tools.sofia.local/sofia/sense/sense_frontend.git;protocol=${PROTOCOL};branch=${BRANCH}"
SRCREV = "${AUTOREV}"
# Set the working directory to S variable
S = "${WORKDIR}/git"
# Add nodejs-native in real time compilation dependencies
# Cuz we will use "npm" command in do_compile
DEPENDS += "nodejs-native"
NPM_CACHE = "${S}/npm_cache"
# Nothing to configure
do_configure(){
}
# Build the web application
do_compile(){
# Export the HOME directory to "S"
export HOME=${S}
# Set npm cache
npm set cache ${NPM_CACHE}
# Make sure cache is clear for each compilation
npm cache clear --force
# Compile and Install
npm install
npm run-script build
# Clear cache again after compilation
npm cache clear --force
}
# Define the /var/www/localhost/html directory
WWW_DIR = "${localstatedir}/www/localhost/"
WWW_USR = "www"
WWW_GRP = "www-data"
SENSE_WEB_DIR = "${D}${WWW_DIR}/html"
# Install the web application into /var/www/localhost/html
do_install(){
# Create the web directory
install -d ${SENSE_WEB_DIR}
# Install the web app build
cp -r ${S}/build/* ${SENSE_WEB_DIR}
# Give right permissions
chown -R ${WWW_USR}:${WWW_GRP} ${D}${WWW_DIR}/
}
# Add <www> user
inherit useradd
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "\
--system --no-create-home \
--home ${WWW_DIR} \
--groups www-data \
--user-group ${WWW_USR}"
Is it a problem with old nodejs version ?
Any ideas?
Thanks, Talel