Undefined packages added after "npm update -g" - npm

I accidentally installed "react" and "react-dom" as global packages, and promptly uninstalled them.
But now everytime I run npm update -g, two undefined packages "+ undefined#0.1.0 (as react-dom)" and "+ undefined#0.1.0 (as react)" are added. npm list -g --depth 0 lists them as "+-- react#npm:undefined#0.1.0" and "+-- react-dom#npm:undefined#0.1.0".
They are not breaking anything, and I can always just uninstall them after they pop up each time, but it's become a minor annoyance.
I tried "npm cache clean --force" but the problem persists.
Please help me find a way to get rid of these undefined packages forever, thank you for your time!

Problem solved after I manually deleted the folders of the undefined projects from the root of my npm installation, on the advice of #ambianBeing.
Note: you can locate the root of your npm installation with npm -g root.

Related

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.
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

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 :)

`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.

NPM still looking for deleted dependency

I deleted some module folders that I had previously npm installed into a module. I also manually removed their entries in my module's package.json. Then, npm would still look for those deleted folders so I re-created the folders and npm uninstalled them, which succeeded. Is there another way to "clear" npm's graph?
Try running npm cache clean --force and then see if the problem still persists. S If would help if you posted your package.json file so that we could see if any problems exist.

Uninstalling global npm package leaves an error in npm list

I'm having some issues uninstalling some of my global npm packages, in that they don't appear to be fully removing.
As an example, I've been trying to remove the beta Angular CLI package (as this package was renamed for its 1.0.0 release). Running npm uninstall -g angular-cli appears to work, however when I then run npm list -g --depth=0 the package appears to remain in the list, now with an error:
error: ENOENT: no such file or directory, open '/usr/local/lib/node_modules/angular-cli/package.json
It appears as though the package has not been fully removed - I'm not sure if this can be fixed using npm prune, or simply by going in and manually deleting any files that may be left over.
I've not had any success googling around the issue, however this could be because I'm not entirely sure what to search for, as evidenced by my not-so-eloquently worded title for this question.
If anyone has any thoughts, I'd be very grateful to hear them!