Cannot find module 'lodash/isEmpty' - npm

Got an error after doing npm start
Error:- https://gist.github.com/anonymous/72b80088aca1e939da5760bee6b39570
Things I did:-
1- I removed lodash folder from node_modules folder, then I cleared the cache using npm cache clear. After that I did npm install, as lodash was present in package.json. But I am getting the same error
2- Then used node version 8.0.0, got same error
3- I've used 'require' to import lodash/isEmpty. So, I don't there is any spelling mistake.
4- I've already checked the presence of isEmpty.js file inside lodash folder, under node_modules directory. And it's there.
Update:- I removed the node_module folder and then I removed the cache using npm cache clean. After that I did npm install. But I am still getting the same error.

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

npm module installation is not picking the current package to install

Getting this weird error while installing expo-modules-core. I have clean the npm cache but it keeps giving me Not Found - GET https://registry.npmjs.org/react-navigation-reanimated - Not found 404 error. Although I'm not installing it.
My package.json file mistakenly contains this wrong package name i.e. react-navigation-reanimated, its react-native-reanimated actually. Removing that from the package.json removed the error.

Old Node_modules folder causing build errors

Previously I was having issues trying to update vue to the latest version so I renamed my node_modules folder to node_modules_OLD and did an npm install. This created a new node_modules folder and updated everything to the latest version. No problem there, except apparently I should have completely removed the node_modules folder because now when I try to run an npm run build I'm getting the following error:
ERROR Failed to compile with 1 errors 14:56:27
This relative module was not found:
* ../../node_modules_OLD/postcss-selector-parser/postcss-selector-parser in ./node_modules/vuetify-loader/lib/loader.js!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/faculty.vue?vue&type=script&lang=js&
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
I've since removed the node_modules_OLD folder but I'm still getting the same error where it's looking for node_modules_OLD. I've also removed the node_modules folder completely and ran npm install again, it created the node_modules folder but it's still throwing the same error on npm run build.
Why would it be looking at the node_modules_OLD folder? And how can I get it to stop looking for it? Removing the node_modules_OLD folder doesn't seem to help.
You can try delete the file package-lock.json, folder node_modules and rerun npm install

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.

How to install npm own local packages?

I have 2 projects(packages) in npm, I want to inject package_A as dependency to package_B. In package_A root folder, I run npm install -g, then npm install it to C:\Users\Myuser\AppData\Roaming\npm\node_moduls\package_A folder. Now in packages.json in package_B I add "package_A": "1.0.0" in dependencies. When in package_B root file I run npm install, its failed package_A#1.0.0 not found.
How can I identified npm to its my own local package?
Notes:
We are a team, then I don't want to address package_A explicitly.
We are using nexus repository manager.
I don't want to publish my projects to http://registry.npmjs.org/.
I'm not 100% clear what you have tried. If you are going to use a custom module for another application you are developing, installing globally won't do the trick. You have to publish that module in npm.
Check this link for more info on publishing in npm
If you have completed the steps correctly, and still no good happens, please check your naming of the module in package.json file.
Instead of typing in the name and version number in package.json file and then npm install, try directly installing in the terminal with --save so that it will automatically be added to package.json file with correct spelling.