<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'main'</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113097459" />
  <subtitle>Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'main'</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=113097459</id>
  <updated>2026-04-07T07:43:44Z</updated>
  <dc:date>2026-04-07T07:43:44Z</dc:date>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113258165" />
    <author>
      <name>mitch hancock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113258165</id>
    <updated>2019-04-16T14:57:17Z</updated>
    <published>2019-04-16T14:57:17Z</published>
    <summary type="html">&lt;blockquote&gt;Ivan ZaeraGood to hear that.&lt;br /&gt;&lt;br /&gt;However, 2.7.1 is a canary release, as you can see in the versions tab of &lt;a href="https://www.npmjs.com/package/liferay-npm-bundler"&gt;https://www.npmjs.com/package/liferay-npm-bundler&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;I&amp;#39;m not saying that you can&amp;#39;t use it because we are already using it too, but keep in mind that the latest stable is 2.6.2, in case you see any strange behaviour.&lt;/blockquote&gt;&lt;br /&gt;Thanks Ivan,&lt;br /&gt;&lt;br /&gt;I have since tried version 2.6.2 however it fails to bundle in that version. &lt;br /&gt;So something changed in version 2.7.1 to make it work for me. &lt;br /&gt;&lt;br /&gt;​​​​​​​Thanks</summary>
    <dc:creator>mitch hancock</dc:creator>
    <dc:date>2019-04-16T14:57:17Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113178658" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113178658</id>
    <updated>2019-04-12T06:45:34Z</updated>
    <published>2019-04-12T06:45:34Z</published>
    <summary type="html">Good to hear that.&lt;br /&gt;&lt;br /&gt;However, 2.7.1 is a canary release, as you can see in the versions tab of &lt;a href="https://www.npmjs.com/package/liferay-npm-bundler"&gt;https://www.npmjs.com/package/liferay-npm-bundler&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;I&amp;#39;m not saying that you can&amp;#39;t use it because we are already using it too, but keep in mind that the latest stable is 2.6.2, in case you see any strange behaviour.</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2019-04-12T06:45:34Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113165281" />
    <author>
      <name>mitch hancock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113165281</id>
    <updated>2019-04-11T16:01:12Z</updated>
    <published>2019-04-11T16:01:12Z</published>
    <summary type="html">I ran a npm audit fix on the module.&lt;br /&gt;&lt;br /&gt;During this parts of the package.json file were updated to newer versions, I am guessing that the key difference is the liferay-npm-bundler got updated from 2.0.0 to 2.7.1&lt;br /&gt;&lt;br /&gt;After this upgrade the error has gone away and the files are bundled so this issue can be closed.&lt;br /&gt;&lt;br /&gt;Thanks for the comments &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;</summary>
    <dc:creator>mitch hancock</dc:creator>
    <dc:date>2019-04-11T16:01:12Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113162393" />
    <author>
      <name>mitch hancock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113162393</id>
    <updated>2019-04-11T15:30:36Z</updated>
    <published>2019-04-11T15:30:36Z</published>
    <summary type="html">Thanks for the reply Ivan.&lt;br /&gt;&lt;br /&gt;My .npmbundlerrc file is empty json such as in the example found in the below link.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://github.com/liferay/liferay-blade-samples/blob/7.1/gradle/apps/npm/angular-npm-portlet/.npmbundlerrc"&gt;https://github.com/liferay/liferay-blade-samples/blob/7.1/gradle/apps/npm/angular-npm-portlet/.npmbundlerrc&lt;br /&gt;&lt;br /&gt;&lt;/a&gt;This compiles for the example angular project found in the link and also compiles for me locally when I run that module with my local instance of liferay 7.1&lt;br /&gt;&lt;br /&gt;So that suggests to me that it is a problem with my module set up some how breaking the bundling component. &lt;br /&gt;&lt;br /&gt;I can go ahead and upload the code into an issue if that is what you suggest?</summary>
    <dc:creator>mitch hancock</dc:creator>
    <dc:date>2019-04-11T15:30:36Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113136036" />
    <author>
      <name>Iván Zaera Avellón</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113136036</id>
    <updated>2019-04-11T11:04:00Z</updated>
    <published>2019-04-11T11:04:00Z</published>
    <summary type="html">Apparently the bundler is failing when trying to instantiate a plugin. This is the source code that is failing:&lt;br /&gt;&lt;br /&gt;&lt;a href="https://github.com/liferay/liferay-npm-build-tools/blob/7d01c884866c9dd4bcd70d2cd15dc2e9b1fa855f/packages/liferay-npm-bundler/src/config/internal/bundler.js#L89"&gt;https://github.com/liferay/liferay-npm-build-tools/blob/7d01c884866c9dd4bcd70d2cd15dc2e9b1fa855f/packages/liferay-npm-bundler/src/config/internal/bundler.js#L89&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;Can you see if there&amp;#39;s something wrong in your .npmbundlerrc file? Otherwise I would advise to create an issue in &lt;a href="https://github.com/liferay/liferay-npm-build-tools/issues"&gt;https://github.com/liferay/liferay-npm-build-tools/issues&lt;/a&gt; and upload a zipped sample project to be able to reproduce it.&lt;br /&gt;&lt;br /&gt;Thanks.</summary>
    <dc:creator>Iván Zaera Avellón</dc:creator>
    <dc:date>2019-04-11T11:04:00Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113122609" />
    <author>
      <name>mitch hancock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113122609</id>
    <updated>2019-04-10T15:47:42Z</updated>
    <published>2019-04-10T15:47:42Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;blockquote&gt;Jacek BorowiecWe faced exactly the same problem, but we found that this must be OS dependent.&amp;nbsp;&lt;br&gt;On the OSX 10.13.6 and Debian v.9 compilation works.&lt;br&gt;On CentOS 7 and Ubuntu 10 we get almost identical error:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;[[b]INFO[/b]] Bundling 18 dependencies...

[[b]INFO[/b]] TypeError: Cannot read property 'main' of undefined

[[b]INFO[/b]]     at loadAsDirectorySync (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:123:20)

[[b]INFO[/b]]     at loadNodeModulesSync (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:150:21)

[[b]INFO[/b]]     at Function.module.exports [as sync] (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:52:17)

[[b]INFO[/b]]     at configRequire (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/util.js:33:37)

[[b]INFO[/b]]     at /home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:104:46

[[b]INFO[/b]]     at Array.map (&amp;lt;anonymous&amp;gt;)

[[b]INFO[/b]]     at instantiatePlugins (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:96:21)

[[b]INFO[/b]]     at Object.getPlugins (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:79:9)

[[b]INFO[/b]]     at /home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/index.js:267:55

[[b]INFO[/b]]     at &amp;lt;anonymous&amp;gt;

[[b]ERROR[/b]] npm ERR! code ELIFECYCLE

[[b]ERROR[/b]] npm ERR! errno 1

[[b]ERROR[/b]] npm ERR! my-npm-angular-portlet@1.0.0 build: `tsc &amp;amp;amp;&amp;amp;amp; liferay-npm-bundler`

[[b]ERROR[/b]] npm ERR! Exit status 1

[[b]ERROR[/b]] npm ERR! 

[[b]ERROR[/b]] npm ERR! Failed at the my-npm-angular-portlet@1.0.0 build script.

[[b]ERROR[/b]] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
​​​​​​​&amp;lt;/anonymous&amp;gt;&amp;lt;/anonymous&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;Yes this is exactly the same error pretty much. I have Windows 10 Pro. Thanks for getting in touch. Not quite sure where to go from this&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>mitch hancock</dc:creator>
    <dc:date>2019-04-10T15:47:42Z</dc:date>
  </entry>
  <entry>
    <title>RE: Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'mai</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113120147" />
    <author>
      <name>Jacek Borowiec</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113120147</id>
    <updated>2019-04-10T15:08:13Z</updated>
    <published>2019-04-10T15:08:13Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;We faced exactly the same problem, but we found that this must be OS dependent.&amp;nbsp;&lt;br&gt;On the OSX 10.13.6 and Debian v.9 compilation works.&lt;br&gt;On CentOS 7 and Ubuntu 10 we get almost identical error:&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;[[b]INFO[/b]] Bundling 18 dependencies...

[[b]INFO[/b]] TypeError: Cannot read property 'main' of undefined

[[b]INFO[/b]]     at loadAsDirectorySync (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:123:20)

[[b]INFO[/b]]     at loadNodeModulesSync (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:150:21)

[[b]INFO[/b]]     at Function.module.exports [as sync] (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/resolve/lib/sync.js:52:17)

[[b]INFO[/b]]     at configRequire (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/util.js:33:37)

[[b]INFO[/b]]     at /home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:104:46

[[b]INFO[/b]]     at Array.map (&amp;lt;anonymous&amp;gt;)

[[b]INFO[/b]]     at instantiatePlugins (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:96:21)

[[b]INFO[/b]]     at Object.getPlugins (/home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/config/internal/bundler.js:79:9)

[[b]INFO[/b]]     at /home/jacekb/src/angular/my-npm-angular-portlet/node_modules/liferay-npm-bundler/lib/index.js:267:55

[[b]INFO[/b]]     at &amp;lt;anonymous&amp;gt;

[[b]ERROR[/b]] npm ERR! code ELIFECYCLE

[[b]ERROR[/b]] npm ERR! errno 1

[[b]ERROR[/b]] npm ERR! my-npm-angular-portlet@1.0.0 build: `tsc &amp;amp;amp;&amp;amp;amp; liferay-npm-bundler`

[[b]ERROR[/b]] npm ERR! Exit status 1

[[b]ERROR[/b]] npm ERR! 

[[b]ERROR[/b]] npm ERR! Failed at the my-npm-angular-portlet@1.0.0 build script.

[[b]ERROR[/b]] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
​​​​​​​&amp;lt;/anonymous&amp;gt;&amp;lt;/anonymous&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Jacek Borowiec</dc:creator>
    <dc:date>2019-04-10T15:08:13Z</dc:date>
  </entry>
  <entry>
    <title>Liferay 7.1 Angular npmRunBuild -  TypeError: Cannot read property 'main'</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113097458" />
    <author>
      <name>mitch hancock</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=113097458</id>
    <updated>2019-04-09T16:10:39Z</updated>
    <published>2019-04-09T16:10:39Z</published>
    <summary type="html">Hey, I am new to angular and also liferay. I am attempting to integrate an angular project into liferay 7.1 using the liferay-npm-bundler.&lt;br /&gt;&lt;br /&gt;I have managed to resolve the hundred or so previous errors so the module is now at a stage where it tries to bundle the 190 dependencies.&lt;br /&gt;&lt;br /&gt;I am now receiving this error, I have googled it but cannot find anything on it at all.&lt;br /&gt;&lt;br /&gt;Any help much appreciated.&lt;br /&gt;​​​​​​​&lt;br /&gt;&lt;br /&gt;&amp;gt; Task :downloadNode SKIPPED&lt;br /&gt;&amp;gt; Task :modules:angular-npm-portlet:downloadNode SKIPPED&lt;br /&gt;&amp;gt; Task :modules:angular-npm-portlet:expandJSCompileDependencies UP-TO-DATE&lt;br /&gt;&amp;gt; Task :modules:angular-npm-portlet:npmInstall UP-TO-DATE&lt;br /&gt;&lt;br /&gt;&amp;gt; Task :modules:angular-npm-portlet:npmRunBuild&lt;br /&gt;&lt;br /&gt;&amp;gt; angular-npm-portlet@1.0.0 build C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet&lt;br /&gt;&amp;gt; tsc &amp;amp;&amp;amp; liferay-npm-bundler&lt;br /&gt;&lt;br /&gt;Bundling 190 dependencies...&lt;br /&gt;TypeError: Cannot read property &amp;#39;main&amp;#39; of undefined&lt;br /&gt;    at loadAsDirectorySync (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\resolve\lib\sync.js:123:21)&lt;br /&gt;    at loadNodeModulesSync (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\resolve\lib\sync.js:150:21)&lt;br /&gt;    at Function.module.exports [as sync] (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\resolve\lib\sync.js:52:17)&lt;br /&gt;    at configRequire (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\liferay-npm-bundler\lib\config.js:97:37)&lt;br /&gt;    at C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\liferay-npm-bundler\lib\config.js:241:22&lt;br /&gt;    at Array.map (&amp;lt;anonymous&amp;gt;)&lt;br /&gt;    at instantiatePlugins (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\liferay-npm-bundler\lib\config.js:233:21)&lt;br /&gt;    at Object.getPlugins (C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\liferay-npm-bundler\lib\config.js:224:9)&lt;br /&gt;    at C:\Users\User\Documents\process-portal\com-company-Project\modules\angular-npm-portlet\node_modules\liferay-npm-bundler\lib\index.js:308:48&lt;br /&gt;    at new Promise (&amp;lt;anonymous&amp;gt;)&lt;br /&gt;npm ERR! code ELIFECYCLE&lt;br /&gt;npm ERR! errno 1&lt;br /&gt;npm ERR! angular-npm-portlet@1.0.0 build: `tsc &amp;amp;&amp;amp; liferay-npm-bundler`&lt;br /&gt;npm ERR! Exit status 1&lt;br /&gt;npm ERR! &lt;br /&gt;npm ERR! Failed at the angular-npm-portlet@1.0.0 build script.&lt;br /&gt;npm ERR! This is probably not a problem with npm. There is likely additional logging output above.&lt;br /&gt;&lt;br /&gt;npm ERR! A complete log of this run can be found in:&lt;br /&gt;npm ERR!     C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-04-09T15_51_10_748Z-debug.log&lt;br /&gt;&lt;br /&gt;&amp;gt; Task :modules:angular-npm-portlet:npmRunBuild FAILED&lt;br /&gt;&lt;br /&gt;FAILURE: Build failed with an exception.&lt;br /&gt;&lt;br /&gt;* What went wrong:&lt;br /&gt;Execution failed for task &amp;#39;:modules:angular-npm-portlet:npmRunBuild&amp;#39;.&lt;br /&gt;&amp;gt; Process &amp;#39;command &amp;#39;cmd&amp;#39;&amp;#39; finished with non-zero exit value 1</summary>
    <dc:creator>mitch hancock</dc:creator>
    <dc:date>2019-04-09T16:10:39Z</dc:date>
  </entry>
</feed>
