Emiel Van de Veire
Emiel Van de Veire

Reputation: 127

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.

Upvotes: 9

Views: 15759

Answers (5)

ashua4488
ashua4488

Reputation: 1

I decided to use yarn to install the dependencies, and it worked like magic. I was amazed. Here are the steps:

First, download and install yarn

npm install -g yarn

Then, use this command to install the dependencies

yarn install

After that, you can run it with npm or yarn.

npm run serve

And that's it! Do try it.

Upvotes: 0

ayoub aarab
ayoub aarab

Reputation: 41

1 yarn remove webpack 2 yarn add webpack. // the problem is the webpack version, so by installing the last version everything works as before.

Upvotes: -1

Erdoğan Yeşil
Erdoğan Yeşil

Reputation: 19

npm install [email protected] --save

Upvotes: -1

Andrey Yaroshenko
Andrey Yaroshenko

Reputation: 153

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

Upvotes: 1

connexo
connexo

Reputation: 56853

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.

Upvotes: 4

Related Questions