FrameworkEvent ERROR – NPMResolverServiceFactory.getService()

Published

I am using Liferay 7.x and building an Angular 8 Portlet.

The problem in short: I have added a new package to the package.json file and server is now complaining about not being able to obtain the inject the NPMResolver within my custom Portlet. Removing the @Reference private NPMResolver _npmResolver; line removes also the issue.

More details and context: I have also looked in the source code and there is a NullPointerException triggered on this line:

map.put(
 srcJSONObject.getString("name"),
 destJSONObject.getString("name")
);

The reason is that srcJSONObject variable is null.
I have also looked into the generated META-INFresourcesmanifest.json file (from my custom module) and yes, the new module that I have added does not have the src and dest properties.
In other words, Liferay expects that manifest.json file to have a list of packages with their modules listed under them and also a src and dest property – an example below:

"src": {
        "id": "[email protected]",
        "name": "ngx-bootstrap",
        "version": "5.3.2",
        "dir": ".node_modulesngx-bootstrap"
      },
"dest": {
        "id": "[email protected]",
        "name": "MyCustomModule$ngx-bootstrap",
        "version": "5.3.2",
        "dir": ".buildresourc[email protected]5.3.2"
      }

The previously added packages have these 2 properties, but the newly added one – which is "ngx-bootstrap" – also adds some of its submodules (like modal, checkbox, multicheck… etc) which do not have src and dest properties.
When Liferay tries to inject the NPMResolver class, it fails to read the manifest.json file and therefore it fails to inject the class property.

The question: why does the manifest.json file not adding the src and dest properties ?

Source: Angular Questions

Published
Categorized as angular, liferay-7 Tagged ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq