Express not working
h
RossJames (6)

Hi,

The express example in nodejs is not working and is having an error where it can't find express module. Any ideas? This one has had me stuck for a little while now

Thanks!

You are viewing a single comment. View All
TheDrone7 (545)

express is a node.js module that has to be first installed. Locally you would be able to accomplish this using package managers like npm or yarn but on repl.it there are two ways: -
1. Modifying the package.json file - Modify the package.json dependecies to match your requirements.
2. Using the repl.it package manager - Click on the little cube icon to the left of repl.it file manager in your repl.it editor and search for the package you want to install and then click on install.

In your case, the required module is express for which you can modify your package.json to look something like this: -

{
  "name": "promo",
  "version": "0.0.1",
  "description": "my second socket.io app",
  "dependencies": {
    "express":"latest"
  }
}

or use the package manager.

Quick tip: Repl.it also offers an already prepared express boilerplate here

RossJames (6)

@TheDrone7 Thanks so much! Have been having problems for days!