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

Which folder should I run 'npm install' from?

I'm unclear which folder I should run 'npm install' from - and the same for 'npm start'.

[This question belongs in the 'learn react' track, on the 'react by example' 'setting up the project' video where there is example code we can download. I am not sure why the question doesn't end up there.]

5 Answers

Jaroslaw Adamowicz
Jaroslaw Adamowicz
11,634 Points

Hi,

what operating system do you use?

In Linux or Mac OS you can use:

which npm

This will tell you where your npm program is located and also ensure it is globaly recognized. If it doesn't work it might be not installed.

You can also try in console (cmd in Windows, terminal in Mac OS):

npm

This should return you something (besides 'not recognize command' or 'command not found'). :)

As for folder I'm not sure if this command takes into consideration your current directory, but if yes just prepare your own folders for it.

Let say you are on D:\ in Windows or Documents in Mac OS, just create something like this:

D:\My_tools\javascript\npm\

or something similar like:

CODE/javascript/tools/npm 

and punch it there!

Just try to remember to name it properly so in future you would now where to look if needed :)

I'm not sure if this helped you somehow, if not please let me know in more detail what you need!

BR,

Jarek

stjarnan
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
stjarnan
Front End Web Development Techdegree Graduate 56,488 Points

Hi Katinka,

You should run it in your project root folder, or the folder above your node_modules folder as sometimes the structure can differentiate between projects. But in general: the root folder of your project, as long as it is one folder above your node_modules.

Hope that helps,

Jonas

Thanks. I am on Ubuntu and am trying the 'create react-app' tutorial.

I think the answer to my question is as follows.

There are two options: 1) Go to the directory where you want your RSVP project and run 'create-react-app app-name'. This will create a basic react app. From the downloads you need the 'RSVP assets' and 'RSVP starter files' folders.

run npm install and npm start from the folder that 'create-react-app' creates.

2) to start up the files that the tutorial creates and run them in the terminal and browser, just do 'npm install' and 'npm start' in the 1-Setting-up-with-Create-React-App/2-Setting up the Project/final-project folder.

Ari Misha
Ari Misha
19,323 Points

Hiya there! You just need to down the .zip file provided by the Teacher in the down sections in your desired location. I prefer all my project files in ~(tilda) location. Extract 'em files in the folder. And cd into the folder where your package.json exists and run npm install and start the dev server. Happy Coding!

~ Ari