Welcome to the Treehouse Community
Looking to learn something new?
Error running example_profile.js
I am following the build a dynamic website with node. When attempting to run the example_profile.js file I am getting this error.
I am using intellij IDEA I have install the node.js plugin and added the node global library to the project.
I am getting this error
/Users/caleb.king/Documents/coding practice/Node Applications/First Node Dynamic Site/example_profile.js:3 var studentProfile = new Profile("chalkers"); ^ TypeError: object is not a function at Object.<anonymous> (/Users/caleb.king/Documents/coding practice/Node Applications/First Node Dynamic Site/example_profile.js:3:22) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:906:3
Nicholas OlsenFront End Web Development Techdegree Student 19,342 Points
I just finished that course. I had a similar issue, but not with example_profile.js. Here are some things I would look for if I were you.
- Make sure profile.js is in the same directory.
- At the top of your file make sure you have var Profile = require('./profile'); Make sure it is "var Profile," not "var profile"
Good look with this NodeJS is super exciting! :)
Chris Skinner3,807 Points
Also make sure you have the following at the bottom of your Profile function (outside)
module.exports = Profile;