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 npm Basics (retiring) Installing Packages with npm Installing Local Packages

npm install bcrypt & also python --version

When i run npm install bcrypt it downloads 111 packages as where the instructors screen shows it only downloaded 1 package (the bcrypt package). I also get a completely different result than Andrews with different WARNINGS.

RESULT

Jaycode@jaycode-pc MINGW64 /c/xampp/htdocs/npm_treehouse
$ npm install bcrypt

> bcrypt@1.0.3 install C:\xampp\htdocs\npm_treehouse\node_modules\bcrypt
> node-pre-gyp install --fallback-to-build

[bcrypt] Success: "C:\xampp\htdocs\npm_treehouse\node_modules\bcrypt\lib\binding\bcrypt_lib.node" is installed via remote
npm WARN saveError ENOENT: no such file or directory, open 'C:\xampp\htdocs\npm_treehouse\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\xampp\htdocs\npm_treehouse\package.json'
npm WARN npm_treehouse No description
npm WARN npm_treehouse No repository field.
npm WARN npm_treehouse No README data
npm WARN npm_treehouse No license field.

+ bcrypt@1.0.3
added 111 packages in 12.513s

ADDITIONALLY after I've downloaded the packages when I type python --version I get the following error message.

Jaycode@jaycode-pc MINGW64 /c/xampp/htdocs/npm_treehouse
$ python --version
bash: python: command not found

PS. Not sure if it makes a difference but I'm using Visual Studio Code on a Windows 10 64-bit operation system.

6 Answers

Two things, 1. do you have a package.json file set up? and 2. you do not have python installed on your computer. Since you are running on Windows, it will be different for the course you will need to download Python.

In the future it's important to be able to read error messages:

npm WARN enoent ENOENT: no such file or directory, open 'C:\xampp\htdocs\npm_treehouse\package.json' - means that the file package.json does not exist.

$ python --version bash: python: command not found - this means that python does not exist because it can not find the command python --version.

Jacob Mishkin I just downloaded python, but don't have the package.json file. I don't recall instructor saying we need either, but this is good to know. Where can I get the package.json file for this lesson? I don't see anything in the teachers notes.

I will have to try and do better in learning to read these error messages. They can be mind boggling for someone who is new to this.

To get started with NPM the first thing to do is in the console write npm init. this will create a package.json file and from there you can install packages like from the videos.

PS During the init process, you will be asked several questions, if you don't know the question being asked don't worry just hit enter and you'll be fine.

Learning how to read an error message is a process like anything else. You will always run into them and being able to read that they are saying really helps in debugging.

Jacob Mishkin Thanks for your answer. One more question if I may. When i run npm install bcrypt or even npm install --python=python2 Why does it download 111 package folders? Shouldn't it only download the 2 packages specified?

This is a hot topic when talking about NPM packages. Your package might have a dependency or several dependencies in order to use. So if I want to use X I might need to also download Y & Z packages so X runs.

Thanks again Jacob Mishkin . Good to know. I better understand now. I kind of suspected that, but wasn't sure because the folder structure in the Instructors video screen is completely different.

your node_modules folder is different or folder structure in general?

Just the node_modules folder.

Cool. The reason for this is because you are on a Windows machine and he is using workspaces/Mac. This will require different dependencies so the node packages will run.

Awesome, thanks, i was convinced I was doing something wrong or missed a step, but this is great to know!

Not a problem. If you run into more issues feel free to post them with your code.