TypeError: Cannot read property 'NormalModule' of undefined

I am working on a big project and I cannot run it anymore because of this error:

When I run npm run serve

 ERROR  TypeError: Cannot read property 'NormalModule' of undefined
TypeError: Cannot read property 'NormalModule' of undefined
    at VueLoaderPlugin.apply (/Users/<user>/muso-ninjas/node_modules/vue-loader-v16/dist/pluginWebpack5.js:44:47)
    at webpack (/Users/<user>/muso-ninjas/node_modules/@vue/cli-service/node_modules/webpack/lib/webpack.js:51:13)
    at serve (/Users/<user>/muso-ninjas/node_modules/@vue/cli-service/lib/commands/serve.js:163:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Please help me because I am stuck and I would like to go with my project.


Solution 1:

Try this first:

  1. In your project root, run npm install. Maybe someone else on your project has changed/added a dependency, and pulling from your git repo got you the code that relies on this, but won't get you the dependency itself.

If that doesn't fix your issue, try this:

  1. Remove the node_modules folder in your project root.
  2. Update your Node.js version to the latest 16.x version.
    2.1 Verify the update has worked by issuing node -v in the terminal.
  3. Update your npm: Run npm i -g npm in the terminal.
    3.1 Very the update has worked by issuing npm -v in the terminal.
  4. Run npm install in your project's root folder.

If this doesn't fix your issue, you need to find help from someone else on your team.

Solution 2:

As suggested in link from the first comment, I deleted node_modules, replaced the node-sass in package.json with "sass": "^1.26.5" and ran npm install but it didn't work.

Then I repeated the steps and removed package-lock.json as well.

This helped and the app was served properly