Error building Liferay Angular portletError building Liferay Angular portlethttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1213770042024-03-28T11:31:30Z2024-03-28T11:31:30ZError building Liferay Angular portletPiotr Wochhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1213770032022-03-11T17:06:05Z2022-03-11T10:08:35Z<p>Hello!</p>
<p>I followed this blog post in an attempt to create a Liferay portlet
that would allow me to embed by Angular app:</p>
<p>
<a href="https://liferay.dev/blogs/-/blogs/how-to-migrate-angular-app-to-angular-widget-for-liferay-manually-https://liferay.dev/blogs/-/blogs/how-to-migrate-angular-app-to-angular-widget-for-liferay-manually-">https://liferay.dev/blogs/-/blogs/how-to-migrate-angular-app-to-angular-widget-for-liferay-manually-</a></p>
<p>One caveat is that when following the above instructions I noticed
the portlet contains references to Angular 10 libraries, while my app
runs still on Angular 9. I corrected the package.json so all the
references point to versions related to Angular 9.</p>
<p>I am getting an error “EMFILE: too many open files, open ‘(…)’ ”. I
suspect it’s caused by the resolve NPM module (invoked by
liferay-npm-bundler) having issues handling 1155 modules in my
node_modules directory, running into the O/S (Windows) limit of number
of open files. I would be grateful for answers to several questions I have:</p>
<p>a) Is there any way to increase the limit of open files in Windows?</p>
<p>b) If not, is there a way to “trim” the number of modules in
node_modules, eg. by removing modules installed by npm install but not
really referenced/used by the application?</p>
<p>c) Is there any other workaround for this problem/error?</p>
<p>Below are the details of the message I am getting:</p>
<pre>
<code>Project assets copied.
Error: EMFILE: too many open files, open 'C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\babel-preset-liferay-standard\package.json'
at Object.openSync (fs.js:438:3)
at readFileSync (fs.js:343:35)
at defaultReadPackageSync (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:58:16)
at loadpkg (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:151:19)
at loadAsFileSync (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:116:19)
at loadAsDirectorySync (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:191:16)
at loadNodeModulesSync (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:203:25)
at Function.resolveSync [as sync] (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\resolve\lib\sync.js:107:17)
at Project.resolve (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\liferay-npm-build-tools-common\lib\project\index.js:228:34)
at Project.toolResolve (C:\liferay\LiferayWorkspacewithDevStudio7.4\liferay-workspace\modules\my-npm-angular-portlet2\node_modules\liferay-npm-build-tools-common\lib\project\index.js:282:25)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-npm-angular-portlet2@1.0.0 build: `tsc && npm run copy-assets && liferay-npm-bundler`
npm ERR! Exit status 1
</code>