title: Cannot find module 'jsonwebtoken' Node.js
body: <p>i am trying to set up an user level authentication using node.js, so i go and do npm install -g jsonwebtoken --save. However, i run into problems when i use require('jsonwebtoken'); and try to compile my code, it gives me the error described above in the title. Now, for some reason, when i uninstall the JWT and try to run my code without it, it compiles, but obviously it doesn't work. I tried re-installing it, still no success. 
  My npm --version
  6.3.0</p>
  
  <p>node --version
  v11.1.0</p>
  
  <p>npm install -g jsonwebtoken --save
  + jsonwebtoken@8.4.0</p>
  
  <p>code:</p>
  
  <pre><code>'use strict';
  
  require('jsonwebtoken');
  
  exports.generateToken = async (data) =&gt; {
      return jwt.sign(data, global.SALT_KEY, { expiresIn: '1d' });
  }
  
  exports.decodeToken = async (token) =&gt; {
      var data = await jwt.verify(token, global.SALT_KEY);
      return data;
  }
  
  exports.authorize = function (req, res, next) {
      var token = req.body.token || req.query.token || req.headers['x-access-token'];
  
      if (!token) {
          res.status(401).json({
              message: 'Acesso Restrito'
          });
      } else {
          jwt.verify(token, global.SALT_KEY, function (error, decoded) {
              if (error) {
                  res.status(401).json({
                      message: 'Token Inválido'
                  });
              } else {
                  next();
              }
          });
      }
  };
  
  exports.isAdmin = function (req, res, next) {
      var token = req.body.token || req.query.token || req.headers['x-access-token'];
  
      if (!token) {
          res.status(401).json({
              message: 'Token Inválido'
          });
      } else {
          jwt.verify(token, global.SALT_KEY, function (error, decoded) {
              if (error) {
                  res.status(401).json({
                      message: 'Token Inválido'
                  });
              } else {
                  if (decoded.roles.includes('admin')) {
                      next();
                  } else {
                      res.status(403).json({
                          message: 'Esta funcionalidade é restrita para administradores'
                      });
                  }
              }
          });
      }
  };
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/BowRJ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/BowRJ.jpg" alt="enter image description here"></a></p>