Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.


Jon Barth
Jon Barth
7,652 Points

error: cannot find module express

My issue: I'm receiving "Error: Cannot Find Module 'express'" when I execute the code below using Command Prompt on my machine.

//Require https module
const https = require('https');
//Require Basic Auth
const app = require('express')()
const basicAuth = require('express-basic-auth')

    users: { 'username': 'password' }

const request = https.get('https://frontier.sandbox.beamery.com/v1/auth', response => {
      let body = "";
  response.on('data', data => {
    body += data.toString();

  response.on('end', () => {


I've ran npm install express -g I've ran npm install express-basic-auth -g

I'm using the live-server npm

If I execute npm list -g --depth=0 I get the following returned: +-- express@4.17.1 `-- live-server@1.2.1

I would assume 'express' could be found since I installed both of the npm's. Does anyone know what my issue could be? Thanks!