ReferenceError: axios is not defined.. In heroku deployment but not in local ReferenceError: axios is not defined.. In heroku deployment but not in local heroku heroku

ReferenceError: axios is not defined.. In heroku deployment but not in local


you have this on your app:

<script src="../node_modules/axios/dist/axios.min.js"></script>

but you should use the CDN with an url like the one provided in Here or if you use NPM as it seems.... import it as a module if you can, like this:

Main.js file

//  Elementsconst movieTitle = document.querySelector('#title');const movieRuntime = document.querySelector('#runtime');const movieRating = document.querySelector('#rating');const movieReview = document.querySelector('#review');const createMovieBtn = document.querySelector('#create-btn');const closeBtn = document.querySelector('#close');const notification = document.querySelector('#notification');const errorDiv = document.querySelector('#error-div');const axios = require('axios');

otherwise it will never find the ..node_modules/axios.... folder because it is not accesible from the front end, it is on your server.