Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Error building Liferay Angular portlet
Hello!
I followed this blog post in an attempt to create a Liferay portlet that would allow me to embed by Angular app:
https://liferay.dev/blogs/-/blogs/how-to-migrate-angular-app-to-angular-widget-for-liferay-manually-
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.
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:
a) Is there any way to increase the limit of open files in Windows?
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?
c) Is there any other workaround for this problem/error?
Below are the details of the message I am getting:
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