# "Uncaught TypeError: Cannot read property 'call' of undefined" in all. js durch plugin js-code

**URL:** <https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272>\
**Category:** Programmierung\
**Created:** [15. April 2020 um 12:54 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272 "2020-04-15T12:54:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cimtana](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@Cimtana](https://forum.shopware.com/u/Cimtana)\
**Post date:** [15. April 2020 um 12:54 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/1 "2020-04-15T12:54:20Z")

</div>

Hallo,  
beim update von shopware 6.0 auf 6.1 musste ich die Struktur einiger Plugins anpassen.  
Nun ist aber das Problem, dass der code&nbsp;der hier gespeichert ist&nbsp;plugin root/src/Resources/app/storefront/dist/storefront/js/plugin-name.js bei der all.js zu problemen führt, und auch deinstallieren und neuinstallieren nicht klappt.

Zuvor war die&nbsp; datei in&nbsp;plugin root/src/Resources/dist/storefront/js/plugin-name.js

---

<div class="post-metadata">

**Author:** ![Cimtana](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@Cimtana](https://forum.shopware.com/u/Cimtana)\
**Post date:** [17. April 2020 um 14:23 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/2 "2020-04-17T14:23:40Z")

</div>

- src
  - Ressources
    - dist
      - storefront
        - js
          - plugin-name.js

    - storefront
      - style
        - scss-datei

      - main.js

So sah die Struktur bezüglich javascript zuvor aus

- src
  - Ressources
    - app
      - storefront
        - dist
          - storefront
            - js
              - plugin-name.js

        - src
          - scss
            - scss-Datei

          - main.js

Kann es sein, dass hierbei der fehler passiert ist?

---

<div class="post-metadata">

**Author:** ![Cimtana](https://avatars.discourse-cdn.com/v4/letter/c/8edcca/32.png) [@Cimtana](https://forum.shopware.com/u/Cimtana)\
**Post date:** [20. April 2020 um 12:24 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/3 "2020-04-20T12:24:00Z")

</div>

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/f/f3b4de4e247149ffb96f544a04efafbd21963d45.png)

So sieht die Fehlermeldung aus.

---

<div class="post-metadata">

**Author:** ![Detect0r](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Detect0r](https://forum.shopware.com/u/Detect0r)\
**Post date:** [20. April 2020 um 16:41 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/4 "2020-04-20T16:41:28Z")

</div>

Ich habe leider auch keine Lösung aktuell dafür, aber wir haben das gleiche Problem mit exakt der gleichen Fehlermeldung und kommen nicht weiter!

In der Entwicklungsumgebung klappt alles einwandfrei, im Livesystem auf einem NGINX Debian Server nicht mehr. Es scheint als würde beim kompilieren via webpack irgendwas fehlen? Es gibt einen github issue hierzu, aber die Lösung (bzw es gibt keine dort)&nbsp;hilft uns nicht:

[https://github.com/shopware/platform/issues/152](https://github.com/shopware/platform/issues/152)

ggf. kann jemand vom @Shopware Team helfen?  
&nbsp;

---

<div class="post-metadata">

**Author:** ![hhoechtl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/hhoechtl/32/15208_2.png) [@hhoechtl](https://forum.shopware.com/u/hhoechtl)\
**Post date:** [2. Mai 2020 um 08:43 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/5 "2020-05-02T08:43:06Z")

</div>

Hatte das Problem auch gerade. Der Hinweis in&nbsp;[Compiled storefront JS not executed by default installation · Issue #152 · shopware/platform · GitHub](https://github.com/shopware/platform/issues/152) war korrekt.

Das hier muss man ändern:

&nbsp;

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/0/0fada698834c653fdc52a05f19e47992f995295a.png)

---

<div class="post-metadata">

**Author:** ![Detect0r](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@Detect0r](https://forum.shopware.com/u/Detect0r)\
**Post date:** [31. Juli 2020 um 09:47 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/6 "2020-07-31T09:47:45Z")

</div>

Wir haben das problem auch bei einem eigenen Plugin, das gebuildete JS beißt sich mit dem auf dem Server concatenaten JS und wir binden die node\_modules korrekt ein…

Wie kann man das vermeiden? Es muss doch möglich sein, eigene node\_modules in der Entwicklung zu verwenden, die korrekt im dev-mode gebundlet werden, sodass es keine Interferenzen gibt?

So sieht unser Plugin import aus:

![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/7/70c13190d0f777e81ade3c2b301e9cbca12bbcd3.png)

Die Fehlermeldung im prod ist die gleiche wie oben:

**Uncaught TypeError: Cannot read property ‚call‘ of undefined" in all. js on line…**

&nbsp;

**Vielleicht kannst Du helfen** [@Moritz Naczenski](http://forum.shopware.com/profile/14574/Moritz%20Naczenski "Moritz Naczenski")**&nbsp;:)**

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![meesKRS](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@meesKRS](https://forum.shopware.com/u/meesKRS)\
**Post date:** [17. November 2020 um 08:14 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/7 "2020-11-17T08:14:05Z")

</div>

I have the same error, Someone with a solution?

---

<div class="post-metadata">

**Author:** ![tomtomd](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@tomtomd](https://forum.shopware.com/u/tomtomd)\
**Post date:** [18. November 2020 um 19:22 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/8 "2020-11-18T19:22:21Z")

</div>

Having the same problem still on 6.3.3.1. I commented the closed ticket ([Compiled storefront JS not executed by default installation · Issue #152 · shopware/platform · GitHub](https://github.com/shopware/platform/issues/152)) hope this will be seen?!

---

<div class="post-metadata">

**Author:** ![hhoechtl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/hhoechtl/32/15208_2.png) [@hhoechtl](https://forum.shopware.com/u/hhoechtl)\
**Post date:** [25. Oktober 2021 um 22:10 UTC](https://forum.shopware.com/t/uncaught-typeerror-cannot-read-property-call-of-undefined-in-all-js-durch-plugin-js-code/66272/9 "2021-10-25T22:10:56Z")

</div>

I found the general cause of this issue:

If you compile your plugin JS locally using the Shopware Storefront webpack configuration, it detects that you have a folder called `node_modules` inside your plugin:

```auto
                ...(() => {
                    if (isProdMode) {
                        return {
                            vendor: {
                                test: path.resolve(__dirname, 'node_modules'),
                                name: 'vendors',
                                chunks: 'all',
                            }
                        }
                    }

```

It doesn’t matter if you use either `../../node_modules` or if you add it as a resolve alias in your own plugins `storefront/build/webpack.config.js` like it’s described in the documentation.  
The webpack config of the storefront will match `node_modules` and extract all those modules into the `vendors.js`, `vendor-node.js` and the `vendor-shared.js` in the dist folder of the Storefront itself.

Which means your plugin only works with this modified JS of the Storefront, which is practically impossible as you can’t force any other user to overwrite the files `vendor/shopware/storefront/Resources/app/storefront/dist/js/vendors.js` (and the others) when your plugin is being installed.
