Call to Node module failed with error: TypeError: Cannot read property 'filter' of undefined #1338

Closed
opened 2025-08-09 17:19:45 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @d4rw1n1s7 on 10/4/2016

Hi,

Following the Microsoft.AspNetCore.SpaServices tutorial, I've faced the above exception. After a little research, I've found that the exception is raised, if the webpack's configuration doesn't contain plugins field. See the following stack-trace:

System.Exception: Call to Node module failed with error: TypeError: Cannot read property 'filter' of null
    at /home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:80:54
    at loadViaWebpackNoCache (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:34:12)
    at Object.loadViaWebpack (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:19:49)
    at findBootModule (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:95:29)
    at findBootFunc (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:103:5)
    at renderToString (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:10:5)
    at module.exports.renderToString (/tmp/tmpryJ0kL.tmp:19:46)
    at /tmp/tmpmiEDvI.tmp:113:19
    at IncomingMessage.<anonymous> (/tmp/tmpmiEDvI.tmp:132:38)
    at emitNone (events.js:86:13)
   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()

I've checked the JavaScriptServices/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts file and found that there is no test of an absent plugins field(lines 93 and 109). Since this field is not required, it needs to check that the field exists before manipulating it. As a workaround, I have added the plugins field with an empty array as its value to my configuration and all works as expected.

*Originally created by @d4rw1n1s7 on 10/4/2016* Hi, Following [the Microsoft.AspNetCore.SpaServices tutorial](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#microsoftaspnetcorespaservices), I've faced the above exception. After a little research, I've found that the exception is raised, if the webpack's configuration doesn't contain `plugins` field. See the following stack-trace: ``` System.Exception: Call to Node module failed with error: TypeError: Cannot read property 'filter' of null at /home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:80:54 at loadViaWebpackNoCache (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:34:12) at Object.loadViaWebpack (/home/george/projects/todolist/node_modules/aspnet-webpack/LoadViaWebpack.js:19:49) at findBootModule (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:95:29) at findBootFunc (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:103:5) at renderToString (/home/george/projects/todolist/node_modules/aspnet-prerendering/Prerendering.js:10:5) at module.exports.renderToString (/tmp/tmpryJ0kL.tmp:19:46) at /tmp/tmpmiEDvI.tmp:113:19 at IncomingMessage.<anonymous> (/tmp/tmpmiEDvI.tmp:132:38) at emitNone (events.js:86:13) at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext() ``` I've checked the [`JavaScriptServices/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts`](https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/LoadViaWebpack.ts) file and found that there is no test of an absent `plugins` field(lines 93 and 109). Since this field is not required, it needs to check that the field exists before manipulating it. As a workaround, I have added the `plugins` field with an empty array as its value to my configuration and all works as expected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1338
No description provided.