Error using Joi-browser library

Hello! I’m doing the react course, but I am getting an error when I use the Joi-browser library. The error is this :

Could not find a declaration file for module ‘joi-browser’. ‘C:/Users/almta/OneDrive/Escritorio/vidly-project/node_modules/joi-browser/dist/joi-browser.js’ implicitly has an ‘any’ type.
Try npm i --save-dev @types/joi-browser if it exists or add a new declaration (.d.ts) file containing declare module 'joi-browser';

I searched for the file in the node-modules folder and i found it, I make sure about importing the module right, but still does not work, what can i do ?

This is whta appears in the console:

Uncaught TypeError: Cannot read properties of undefined (reading ‘string’)
at new RegisterMovieForm (registerMovie.jsx:21:1)
at constructClassInstance (react-dom.development.js:14323:1).

But that is a method of Joi library

I have the same problem.

I already solve it, just open your terminal and desinstall joi browser using this command “npm uninstall -D joi-browser”, and then install it another time, but this time without the version that mosh uses, (with this command “npm i joi-browser”). By the way, since we are in the same part of the course i would like to study together. I think that the only thing that i miss about the schools or college are the partners hahaha

hey man , yes we can. How are we going to do that ? I just came accross the same error when installing the Node back end.

Mm I’m still not at that part of the course hahah now I’m having an issue with the React-Toastify library

Did you sort it out ? I relized that Bootstrap had toast too , check if u chose the right toast

I don’t think that the problem is in the code, what appears in my console is this “/node_modules/react-toastify/dist/react-toastify.esm.mjs
Module build failed: Error: ENOENT: no such file or directory, open” Im sure that it is in the directory beacause i search for it and I’m sure that i wrote it well when I import it

1 Like

Did you ever find a solution to this? I am also having issues with toastify, I assume its to do with using the latest version with Mosh’s outdated downloaded http-app

create a new TypeScript declaration file (.d.ts ) in your project (e.g., joi-browser.d.ts )

declare module 'joi-browser';

This tells TypeScript that the module 'joi-browser' exists