Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Build a Simple Dynamic Site with Node.js Handling Routes in Node.js Populating User Information

BIG PROBLEM WITH REQUIRE AND IMPORT

I encounter so many problems when i use require() to get a whole file into another. so i made a reseach and realized i could change my file extension to .mjs and use import{}. but it gets difficult when i get to this particular video. because i can't import all functions from the profile.js file into the router.js file. i get an idea to set "type":"module" in my json package but they were no json package in the files i downloaded treehouse. please some one should help me because it gets so annoying .

1 Answer

Travis Alstrand
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Travis Alstrand
Data Analysis Techdegree Graduate 49,443 Points

Hey there khaper bas22 :wave:

I've never taken this course specifically but if you need a package.json file in the folder you're working in, you can just run the npm init command in your terminal. Make sure your at the desired directory by using the cd "change directory" command then run it. You could also skip all the set up questions by adding the -y flag npm init -y.

If this doesn't help, can you post what the errors you're encountering are saying?