Subject: [SUMO] NPM package recipe Javascript heap out of memory To: yocto@lists.yoctoproject.org From: "Bel Hadj Salem Talel" X-Originating-Location: Tunis, Gouvernorat de Tunis, TN (41.226.168.190) X-Originating-Platform: Linux Firefox 81 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Thu, 08 Oct 2020 06:23:09 -0700 Message-ID: Content-Type: multipart/alternative; boundary="N4EplJv09rpnnYIVeXsK" --N4EplJv09rpnnYIVeXsK Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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/ic= ons@^2.0.0 but none is installed. You must install peer dependencies yourse= lf. | 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 you= rself. | npm WARN draftjs-utils@0.10.2 requires a peer of draft-js@^0.11.x but no= ne is installed. You must install peer dependencies yourself. | npm WARN jsdom@15.2.1 requires a peer of canvas@^2.5.0 but none is insta= lled. 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/markercluster= erplus@^2.1.29 but none is installed. You must install peer dependencies yo= urself. | npm WARN react-instantsearch-native@5.7.0 requires a peer of react-nativ= e@>=3D 0.32.0 but none is installed. You must install peer dependencies you= rself. | npm WARN slick-carousel@1.8.1 requires a peer of jquery@>=3D1.8.0 but no= ne 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 insta= lled. 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 i= nstalled. You must install peer dependencies yourself. | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_mod= ules/fsevents): | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for f= sevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux",= "arch":"x64"}) | npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_mo= dules/chokidar/node_modules/fsevents): | npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for f= sevents@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/im= x-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 upd= ate` | | <--- Last few GCs ---> | | [26063:0x3639a50]=C2=A0=C2=A0=C2=A0 63259 ms: Mark-sweep 1404.3 (1487.5)= -> 1404.4 (1487.5) MB, 686.5 / 0.0 ms=C2=A0 allocation failure GC in old s= pace requested | [26063:0x3639a50]=C2=A0=C2=A0=C2=A0 63966 ms: Mark-sweep 1404.4 (1487.5)= -> 1404.3 (1459.5) MB, 707.1 / 0.0 ms=C2=A0 last resort GC in old space re= quested | [26063:0x3639a50]=C2=A0=C2=A0=C2=A0 64673 ms: Mark-sweep 1404.3 (1459.5)= -> 1404.3 (1459.5) MB, 705.9 / 0.0 ms=C2=A0 last resort GC in old space re= quested | | | <--- JS stacktrace ---> | | =3D=3D=3D=3D JS stack trace =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D | | Security context: 0x1e195c298ed1 |=C2=A0=C2=A0=C2=A0=C2=A0 1: push(this=3D0x29586960fcc1 ) |=C2=A0=C2=A0=C2=A0=C2=A0 2: /* anonymous */(aka /* anonymous */) [/media/= raach/abd909e5-d129-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-p= oky-linux/sense-web/1.1.6-r0/git/node_modules/webpack-sources/lib/applySour= ceMap.js:~58] [pc=3D0x1edb749f50fe](this=3D0x1e195c282241 ,chunk= = =3D0x245a6ac85169 ,middleMapping=3D0x7288a626e89 , unsigned int, v8::internal::Handle, v8::internal::PropertyAttributes, v8::internal::Object::ShouldThrow) [= node] |=C2=A0 9: v8::internal::Object::AddDataProperty(v8::internal::LookupItera= tor*, v8::internal::Handle, v8::internal::PropertyAtt= ributes, v8::internal::Object::ShouldThrow, v8::internal::Object::StoreFrom= Keyed) [node] | 10: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8:= :internal::Handle, v8::internal::LanguageMode, v8::in= ternal::Object::StoreFromKeyed) [node] | 11: v8::internal::Runtime::SetObjectProperty(v8::internal::Isolate*, v8:= :internal::Handle, v8::internal::Handle, v8::internal::Handle, v8::internal::Languag= eMode) [node] | 12: v8::internal::Runtime_SetProperty(int, v8::internal::Object**, v8::i= nternal::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 additi= onal logging output above. I compared the nodejs-native recipes versions , for sumo it's 8.9.4-r0 , a= nd in Zeus it's 10.16.3-r0 Here is my recipe: BRANCH =3D "master" PROTOCOL =3D "http" SRC_URI +=3D "git://gitlab.tools.sofia.local/sofia/sense/sense_frontend.gi= t;protocol=3D ${ PROTOCOL} ;branch=3D ${ BRANCH} " SRCREV =3D " ${ AUTOREV} " # Set the working directory to S variable S =3D " ${ WORKDIR} /git" # Add nodejs-native in real time compilation dependencies # Cuz we will use "npm" command in do_compile DEPENDS +=3D "nodejs-native" NPM_CACHE =3D " ${ S} /npm_cache" # Nothing to configure do_configure (){ } # Build the web application do_compile (){ # Export the HOME directory to "S" export HOME=3D ${ 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 =3D " ${ localstatedir} /www/localhost/" WWW_USR =3D "www" WWW_GRP =3D "www-data" SENSE_WEB_DIR =3D " ${ 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 user inherit useradd USERADD_PACKAGES =3D " ${ PN} " USERADD_PARAM_${PN} =3D "\ --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 --N4EplJv09rpnnYIVeXsK Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 thi= s error occurred :


Log data follows
| DEBUG: Executin= g shell function do_compile
| npm WARN @ant-design/icons-react@2.0.1 r= equires 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-util= s@0.10.2 requires a peer of draft-js@^0.11.x but none is installed. You mus= t install peer dependencies yourself.
| npm WARN jsdom@15.2.1 requires= a peer of canvas@^2.5.0 but none is installed. You must install peer depen= dencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer o= f @types/googlemaps@^3.0.0 but none is installed. You must install peer dep= endencies yourself.
| npm WARN react-google-maps@9.4.5 requires a peer= of @types/markerclustererplus@^2.1.29 but none is installed. You must inst= all peer dependencies yourself.
| npm WARN react-instantsearch-native@= 5.7.0 requires a peer of react-native@>=3D 0.32.0 but none is installed.= You must install peer dependencies yourself.
| npm WARN slick-carouse= l@1.8.1 requires a peer of jquery@>=3D1.8.0 but none is installed. You m= ust 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 dep= endencies yourself.
| npm WARN ws@7.2.1 requires a peer of utf-8-valid= ate@^5.0.2 but none is installed. You must install peer dependencies yourse= lf.
| 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":"an= y"} (current: {"os":"linux","arch":"x64"})
| npm WARN optional SKIPPIN= G 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-6a467a0= 44bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-web/1.1.6-r0/git
| > react-app-rewired build
|
| Creating an optimized produc= tion build...
| Browserslist: caniuse-lite is outdated. Please run nex= t command `npm update`
|
| <--- Last few GCs --->
| <= br />| [26063:0x3639a50]    63259 ms: Mark-sweep 1404.3 (148= 7.5) -> 1404.4 (1487.5) MB, 686.5 / 0.0 ms  allocation failure GC i= n old space requested
| [26063:0x3639a50]    63966 ms: = Mark-sweep 1404.4 (1487.5) -> 1404.3 (1459.5) MB, 707.1 / 0.0 ms  l= ast resort GC in old space requested
| [26063:0x3639a50]  &n= bsp; 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 --->
|
| =3D=3D=3D=3D JS stack trace = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
|
| Securit= y context: 0x1e195c298ed1 <JSObject>
|     1= : push(this=3D0x29586960fcc1 <JSArray[386408]>)
|  &nb= sp;  2: /* anonymous */(aka /* anonymous */) [/media/raach/abd909e5-d1= 29-4759-ab4a-6a467a044bc5/imx-sumo/imx8/tmp/work/aarch64-poky-linux/sense-w= eb/1.1.6-r0/git/node_modules/webpack-sources/lib/applySourceMap.js:~58] [pc= = =3D0x1edb749f50fe](this=3D0x1e195c282241 <undefined>,chunk=3D0x245a6= ac85169 <String[2]: e}>,middleMapping=3D0x7288a626e89 <Object map = = =3D ...
|
| 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::FatalProcessOutOfMem= ory(char const*, bool) [node]
|  5: v8::internal::Factory::NewUni= nitializedFixedArray(int) [node]
|  6: 0xb34a3b [node]
|&nbs= p; 7: 0xb34c65 [node]
|  8: v8::internal::JSObject::AddDataElemen= t(v8::internal::Handle<v8::internal::JSObject>, unsigned int, v8::int= ernal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes= , v8::internal::Object::ShouldThrow) [node]
|  9: v8::internal::O= bject::AddDataProperty(v8::internal::LookupIterator*, v8::internal::Handle&= lt;v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal= ::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
| = 10: v8::internal::Object::SetProperty(v8::internal::LookupIterator*, v8::in= ternal::Handle<v8::internal::Object>, v8::internal::LanguageMode, v8:= :internal::Object::StoreFromKeyed) [node]
| 11: v8::internal::Runtime:= :SetObjectProperty(v8::internal::Isolate*, v8::internal::Handle<v8::inte= rnal::Object>, v8::internal::Handle<v8::internal::Object>, v8::int= ernal::Handle<v8::internal::Object>, v8::internal::LanguageMode) [nod= e]
| 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 i= s probably not a problem with npm. There is likely additional logging outpu= t above.


I compared the nodejs-native recipes versions , f= or sumo it's 8.9.4-r0 , and in Zeus it's 10.16.3-r0

Here is my r= ecipe:

BRANCH =3D "master"
PROTOCOL =3D "http"
SRC_URI +=3D "git://gitlab.tool= s.sofia.local/sofia/sense/sense_frontend.git;protocol=3D${PROTOCOL};branch=3D${BRANCH}"
SRCREV =3D "${AUTOREV}"

# Set the working= directory to S variable
S =3D "${WORKDIR}/git"

# Add nodejs-nati= ve in real time compilation dependencies
# Cuz we will use= "npm" command in do_compile
DEPENDS +=3D "nodejs-native"

NPM_CACHE =3D "${S}/npm_cache"

# Nothing to conf= igure
do_configure(){
}

# Build the web a= pplication
do_compile(){
# Export the HOME directory to "S"
export HOME=3D= ${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 =3D "${localstatedi= r}/www/localhost/"
WWW_USR =3D "www"
WWW_GRP =3D "www-data"
SENSE_WEB_DIR =3D "${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/* <= span style=3D"color: #859900;">${SEN= SE_WEB_DIR}

# Give right permissions
chown -R ${WWW_USR}:${WWW_G= RP} ${D}${WWW_DIR}/
}

# Add <www>= user
inherit useradd
USERADD_PACKAGES =3D "${PN}<= /span>"
USERADD_PARAM_${PN} =3D "\
--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 --N4EplJv09rpnnYIVeXsK--