Skip to content Skip to sidebar Skip to footer

Referenceerror: Require Is Not Defined (webstorm)

Trying to do something incredibly basic, but running into a snag. var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/jetbrains'); var Product = mongoose.mod

Solution 1:

You are probably trying to run the above code in the Browser. It's supposed to run on the Node server. Node automatically defines the require function so you would never have this problem.

Check out this question for good "getting started" material.

EDIT

That's really strange. WebStorm is definitely running Node.js if it's running on the Terminal. Can you please put a break point on the first line, debug the file and inspect the require function?

image

Post a Comment for "Referenceerror: Require Is Not Defined (webstorm)"