Cannot find module - node.js

hope all doing good,
I did node version(v14.18.0) update in my project, after I'm getting module not found issue (screenshot attached), waiting for your suggestion.

You need to install packege and make sure they are listed in package.json dependency

Related

Problems exporting a functional component in a ReactJS Module

I'm having problems importing my functional component BusinessCard (declared here https://github.com/HenryFBP/react-business-card-hfbp/blob/master/src/BusinessCard.tsx#L20)
into a different project (here https://github.com/HenryFBP/personal-website-react/blob/master/src/pages/PageContact.tsx#L3).
I used npm link react-business-card-hfbp, and I can see the symlinked folder, but I must be doing the export incorrectly or don't understand package.json.
I have also tried installing from https://www.npmjs.com/package/react-business-card-hfbp/ but that does not seem to work either.
The error (below) from webpack is Module '"react-business-card-hfbp"' has no exported member 'BusinessCard'.. I tried so many different combinations, edited package.json quite a lot, but I am stuck on this.
I'm sure the answer is simple, I just don't have enough experience with Node Modules to understand what is going on.
Thanks so much <3
I fixed it! With the help of a kind person on "Reactiflux" Discord server.
TL;DR: I was not compiling it into a module correctly. I should have used parcel to compile it into a module. I thought that TypeScript could be included in modules - this is apparently not correct, you must somehow turn it all into JavaScript first.
Working code:
npm run build
npm publish
Working package.json:
https://github.com/HenryFBP/react-business-card-hfbp/blob/master/package.json#L42

Webpack loading wrong version of Node Module for Angular project

I have a project in Angular 13. I want to use quillJS and I want to add tables so I tried to install quill-better-table in my project.
For some reason the package is not working. I used the web inspector and found this to be the issue:
ERROR TypeError: quill.keyboard.bindings.Backspace is undefined
The problem seems to be located at: quill_better_table_BetterTable quill-better-table.js:2979 and when I check the debugger I can see the line:
let thisBinding = quill.keyboard.bindings['Backspace'].pop();
quill.keyboard.bindings['Backspace'].splice(0, 1, thisBinding); // add Matchers to match and render quill-better-table for initialization
// or pasting
I found a github repo that had this issue fixed:
https://github.com/LosEcher/quill-better-table
The problem I'm running into is I dont know how to get that particular repo into my project. I have tried updating the current package and webpack continues to load the old one. I've tried clearing the npm cache and reinstalling the node packages.
I found this guide: https://whatapalaver.co.uk/npm-dependency which seems to indicate what I should do but I'm not quite npm literate enough to figure it out. Specifically, I dont know that I understand how to create the NPM link.
I'm looking for advice as to how to fix this package. I am going to be reading up on NPM link but I figured if there was another easier way to get this fixed then I would ask. I can load that repo into my node module folder, but I dont know how to make webpack reload the updated module.
Thanks in advance for the help, let me know what details I for got to add.

Cannot find module './clone.js'

I installed angular cli via terminal. When I try to use ng(to create a new project), I get an error: Cannot find module './clone.js'terminal snap
I've tried to delete angular and clear cache, but that didn't help. Can somebody come up with solution, please?
graceful-fs, which is depended on by a LOT of npm packages, just released 4.1.12, which has a bug in it: https://github.com/isaacs/node-graceful-fs/issues/139
try upgrading to the new version of angular
ng update

depcheck with Node.js - finding require('x') where x is not in package.json

I found this library called depcheck:
https://www.npmjs.com/package/depcheck
At first I just assumed that it did what I want - find modules that are used in the code but not declared in package.json, but all it does it look for unused dependencies. I am looking for the exact reverse- dependencies that are used in the code but not declared in package.json.
Is there such an NPM module that can do this? I can't find it. The reason this matters is that when deploying Node.js applicatons it's very common that we are missing a dependency in package.json that we are using our code because one of us forgot to include the --save option when running npm install x.
dependency-check looks like it does what you need.
I could not find a suitable solution to this problem so I created my own that we are using in production with Mocha testing -, I hope it might be useful to you also:
https://www.npmjs.com/package/nodejs-dep-check

node module install error (Node.js)

I can't install any node.js module without the follwing errors popping up. The error codes refer to the package.json file. Any idea why this would be happening would be hugely appreciated.
Those are not errors, they are just warnings. Everything is as it should be, though the module owners should probably clean up their package.json files.
Those are not errors, are warnings.
As I already stated in the same question right here, this is just a new check added as of NPM 1.2.20.
There are so much packages in NPM that still lack the repository field in their package.json file.

Resources