TypeError: Cannot read property 'NormalModule' of undefined - vue.js

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.

Try this first:
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:
Remove the node_modules folder in your project root.
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.
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.
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.

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

npm install webpack#4.39.3 --save

Related

How can resolve the NPM issue? Stuck with npm start error

The issue I have is that npm start cannot start. I tried to fix with audit, deleted node_dependency directory and re-installed with npm, nothing works.
One concrete issue I see is:
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.44.2"
Yet, I also see npm -v webpack -> 6.14.14. How do I need to debug this?
Your npm -v webpack command is not correct. it will return npm version and not the webpack version.
Try npm ls webpack . you can also check your package.json file for the packages you have. or run npm ls for the full list.
make sure to install the required dependency as it states.
Eventually I could not solve the package problem with an informed debugging.
What I did was to (npm install --global yarn) and start the application through it (yarn start). It worked a lot to download the packages and eventually started the application.
So, I guess I need to switch to yarn after this point, which is ok, as long as it works :)

Error "Cannot read property "matches" of undefined" when using "npm install"

I'm trying to install expo globally on my Windows 10 machine for a school assignement.
As the doc says, I've been trying the following command in my terminal :
$ npm install --global expo-cli
but it always gives me the same error :
npm ERR! Cannot read property 'matches' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2021-04-07T13_43_16_562Z-debug.log
I've tried running $ npm install -g expo-cli instead but the same thing happens.
I haven't tried reinstalling node or anything yet because I need my pc up and running for this week and I'm not too accustomed to all that, I'd like to keep that a last resort if possible.
Has anyone ever encountered this error before ?
Thanks to those who replied but I "accidentally" fixed it myself.
Through my searching I ended up actually uninstalling node with $ nvm uninstall v15.0.0 and I found myself obligated to download it again here.
Must've been a problem with the version I was using as suggested before.
Try removing the node_modules folder and package-lock.json file and run command npm install.

`npx create-nuxt-app <project name>` not working: MacOSX

I use a MacOS High Sierra. For anyone with experience with Nuxt.js, the command
npx create-nuxt-app <project-name> has not worked for me at all!
I consistently come across errors from npm saying I need to update my dependencies. I first tried updating each dependency using npm outdated (check for outdated packages) and
npm update <pkg name>. This did not work.
I also uninstalled and reinstalled node and npm and tired the above (and below processes). Still did not work.
No matter what I do, the Terminal keeps saying my core-js needed to be updated so I did that (I tried both npm i core-js and npm i core-js ) - they did not work.
To update the npm dependencies, I used the command npm install -g npm-check-updates followed by ncu -u, and then tried both npm update and npm install. Nothing has worked so far.
Lastly, I've tried creating a package.json since npm complained that I had no package.json so I created one using npm init and following the instructions to commit the file(s) created. Still, nothing after running npx create-nuxt-app <project-name>.
What is happening? Has anyone experienced this issue? I really love Nuxt.js and I've tried this for an entire day but I'm giving up on using NuxtJS.
EDIT: I managed to solve part of my problem by creating a Nuxt app from scratch. However, I get the following errors:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt-app#2.11.0 dev:nuxt
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt-app#2.11.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
There are many solution based on your problem. Sharing a simple one, if you have npm installed then execute below command to install npx:
npm install -g npx
you can find all others solution from here
and My suggestions are:
As i saw your description, package.json not created. definitely something wrong for creation of the project, it may cause the read write problem of files into disk. or you have created the project into subdirectory but trying to run the project from parent directory. initially many peoples doing this practice to create scratch project. by the way create a separate directory and then run npx create-nuxt-app. no need to give project name and pass the phase when prompt to create project in same directory. so then i think problem will solved
I fixed the issue! It worked when I created a new directory altogether (the next day) and reran npx create-nuxt-app <new-app>. Get started, build for production, and tests ran perfectly.

How do I install react and react-redux onto my project?

Good afternoon,
I am trying to install react and react-redux onto my project, but I keep getting errors that I don't understand.
$ npx create-react-app learn-redux
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Phelps\AppData\Roaming\npm-cache\_npx\13464" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Taylor Phelps\AppData\Roaming\npm-cache\_logs\2020-02-08T20_44_17_568Z-debug.log
Install for [ 'create-react-app#latest' ] failed with code 1
Could not install from "Phelps\AppData\Roaming\npm-cache\_npx\13464" as it does not contain a package.json file.
I am reading the error, but the problem is...that folder does not exist on my computer and I've checked in the terminal for npm and npx and both are installed on my computer. Does anyone have any ideas on why this may be happening and how to fix it?
Thank you.
According to this Github issue npx has trouble running on Windows if the user has a space in their name and from the error message I'd guess that is the case here. One of the suggested fixes is to set your npm-cache path to a folder without a space in it:
npm config set cache C:\tmp\nodejs\npm-cache --global
Then try running your command again.
Install the project in another directory except C partition :
npx create-react-app learnredux
Then :
npm i react-redux --save
This should work.
The problem is the npm cache by the path of the error. Try running:
npm cache verify
Verify the contents of the cache folder, garbage collecting any
unneeded data, and verifying the integrity of the cache index and all
cached data.
(from https://docs.npmjs.com/cli-commands/cache.html)

How to resolve TypeError: undefined is not an object (evaluating '_core.pathUtils.urlToPathAndParams') in React-Native

My app was running perfectly but when I pull data from the git repository, I got this error.
I'm not understanding why I'm getting this error. Please help to get rid of this error and explain to me about this error.
The error is TypeError: undefined is not an object (evaluating '_core.pathUtils.urlToPathAndParams')
You may need to install #react-navigation/native.
I tried many time this method but got this error
I delete the node_modules and package-lock.json file and run npm install in terminal but error didn't remove.
The second method:
Then I did some similar steps
I run these commands:
rm -rf node_modules/
yarn install
yarn start --reset-cache
Now the error is gone.
try this one ( second method ) if you also getting these types of error.
This type of error occur because of
in your pull request you might be get some new npm in your
package.json file. so try to do npm install
or
try to remove node_modules and package-lock.json file
do npm install might be solve your problem
I encountered the same problem.
In my case, the reason is that I did not have #react-navigation/core at first, then I installed #react-navigation/core at the newest version, which is not compatible with my old #react-navigation/native.
After I updated my #react-navigation/native to have the same version with #react-navigation/core, the problem is solved.
You may want to check the versions of your #react-navigation components to see if they are compatible.
Check the installed packages
npm ls --depth=0
Install #react-navigation/native if you missing this package.