title: Uncaught TypeError: firebase.storage is not a function
body: <p>I am trying to create a reference to my firebase storage but I am getting the error: <strong><em>Uncaught TypeError: firebase.storage is not a function</em></strong>.
  How can I solve this?</p>
  
  <p>There is a similar question where node is used, but in my case I am not using node and hence I don't know if the answer will solve my problem.<a href="https://stackoverflow.com/questions/41352150/typeerror-firebase-storage-is-not-a-function">TypeError: firebase.storage is not a function</a></p>
  
  <p>My code is shown below:</p>
  
  <p><strong>In my app.js:</strong></p>
  
  <pre><code>console.log("Initialisation Successful!");
  var db = firebase.firestore();
  var storage = firebase.storage();
  var storageRef = storage.ref();
  var imagesRef = storageRef.child('Images');
  
  
  function addExerise(){
      var exerciseName = document.getElementById("ename").value;
      var exercisePart = document.getElementById("body_part").value;
      var exerciseLevel = document.getElementById("elevel").value;
      var file = document.getElementById("eimage");
      console.log(file);
  
      file.addEventListener('change', function(evt) {
        let imageFile = evt.target.files[0] // upload the first file only
        let uploadTask = imagesRef.put(imageFile)
    })
  
  
  
      /*var file = storageRef.child(file.name);
      ref.put(file).then(function(snapshot) {
           alert("File Uploaded")
           console.log('Uploaded a blob or file!');
        });*/
  
  
      db.collection("Exercises").add({
          Name: exerciseName,
          bodyPart: exercisePart,
          Level: exerciseLevel,
          //image: file
  
      })
      .then(function(){
          console.log("Data entered successfully!");
      })
      .catch(function(error){
          console.error("Error!", error);
      });
  }
  </code></pre>
  
  <p><strong>Firebase Initialisation in my html page:</strong></p>
  
  <pre><code>&lt;!--Firebase--&gt;
              &lt;script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-app.js"&gt;&lt;/script&gt;
              &lt;script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-firestore.js"&gt;&lt;/script&gt;
  
              &lt;script&gt;
                  var firebaseConfig = {
                      apiKey: "############################",
                      authDomain: "########.firebaseapp.com",
                      databaseURL: "###########.firebaseio.com",
                      projectId: "#############",
                      storageBucket: "gs://##########.appspot.com",
                      messagingSenderId: "##############",
                      appId: "###############################"
                    };
                  // Initialize Firebase
                  firebase.initializeApp(firebaseConfig);
              &lt;/script&gt;
              &lt;script src="app.js"&gt;&lt;/script&gt;
          &lt;!--/Firebase--&gt;
  </code></pre>
  
  <p>Solved:</p>
  
  <p>Added the line below in my html.</p>
  
  <pre><code>&lt;script src="https://www.gstatic.com/firebasejs/7.0.0/firebase-storage.js"&gt;&lt;/script&gt;
  </code></pre>