Kylart / MalScraper

Scrape everything you can from MyAnimeList.net
MIT License
175 stars 50 forks source link

When using getInfoFromName it returns in console as TypeError: axios.get is not a function #122

Closed BenVuong closed 2 months ago

BenVuong commented 2 months ago

My Code: const [name, setName] = useState() const navigate = useNavigate(); var malScraper = require('mal-scraper') const animeName = "Black Lagoon" useEffect(()=>{ malScraper.getInfoFromName(animeName) .then((data) => setName(data.englishTitle)) .catch((err) => console.log(err)) console.log(name) }, [])

Console Log: TypeError: axios.get is not a function at info.js:194:1 at new Promise () at getResultsFromSearch (info.js:188:1) at info.js:222:1 at new Promise () at Object.getInfoFromName (info.js:216:1) at CreateAnime.jsx:19:1 at commitHookEffectListMount (react-dom.development.js:23150:1) at commitPassiveMountOnFiber (react-dom.development.js:24926:1) at commitPassiveMountEffects_complete (react-dom.development.js:24891:1)

BenVuong commented 2 months ago

My current dependencies "dependencies": { "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@mui/material": "^5.15.16", "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "axios": "^1.6.2", "bootstrap": "^5.3.2", "mal-scraper": "^2.13.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.20.1", "react-scripts": "5.0.1", "uuidv4": "^6.2.13", "web-vitals": "^2.1.4" },