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 Express Basics Getting Started with Express Install Express

'code app.js' isn't opening a new file

Hi all! Hoping you'll be able to help...

I'm following Andrew's instructions, using the VSCode terminal and successfully (I think) created a directory, accessed the directory and installed express.

When it gets to the point of creating the app.js file with the code 'code app.js' I receive a response in the terminal saying 'bash: code: command not found'

It would be appreciated if anyone who has encountered this and would be happy to share a solution!

Update:

I did some further googling and attempted node app.js instead of code. This returns a new error, saying 'Cannot find module '/Users/tristandauvergne/flashcards/app.js''

2 Answers

Hi Tristan Dauvergne ,

code app.js

The above command will create a file in the path where your terminal is open. For using the vscode command code you need to install code command in path. Just press cmd+shift+p in vs code and type "shell command" and hit enter on install code in PATH.

I hope it helps.

Thanks Ashish! That did the job :D