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

How do i run a node project with my project name? (global module)

Is there any way to run my node project on CLI without node app.js?

Ex: if my project calls "weatherapp", can i use weatherapp on CLI to run it?

2 Answers

In your package.json file, you can add

"scripts": {
    "weatherapp": "node app.js"
 }

And then you can run node weatherapp

I tried... but CLI doesn't recongnize the command "weatherapp"

Can you provide the output in your CLI?

Wow, you made your own npm package. Super cool!