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

Databases Mongo Basics Go Further With Mongo Updating Data

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Problem installing Mongo-Hacker on Windows.

I use windows 10 on my laptop but I have a feeling I'd have a similar probllm on my Windows 7 desktop.

My current version of npm is 2.15.1

After attempting to install hacker in the project directory I get the following.

$ npm install -g mongo-hacker

> mongo-hacker@0.0.13 install C:\Users\name\AppData\Roaming\npm\node_modules\mongo-hacker
> make install

'make' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "mongo-hacker"
npm ERR! node v4.4.4
npm ERR! npm  v2.15.1
npm ERR! code ELIFECYCLE

npm ERR! mongo-hacker@0.0.13 install: `make install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mongo-hacker@0.0.13 install script 'make install'.
npm ERR! This is most likely a problem with the mongo-hacker package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     make install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs mongo-hacker
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls mongo-hacker
npm ERR! There is likely additional logging output above.

> mongo-hacker@0.0.13 postuninstall C:\Users\name\AppData\Roaming\npm\node_modules\mongo-hacker
> make uninstall

'make' is not recognized as an internal or external command,
operable program or batch file.
npm WARN continuing anyway mongo-hacker@0.0.13 postuninstall: `make uninstall`
npm WARN continuing anyway Exit status 1

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\name\Documents\mongo\npm-debug.log

Can anyone debug this for me and advise :)

8 Answers

Greg Clinton
Greg Clinton
8,091 Points

This is how I got mongo working on Windows the same as OSX. (some info from myself most copied from random sites) It will take about 10mins.

  • Use a decent terminal on windows. http://cmder.net/ is great and also lets you use unix commands.

To be able to type "mongod" and launch mongo from cmder, you need to set a path environment variable follow this guide - http://www.acemyskills.com/install-configure-and-start-mongodb-in-windows/

-Install make with choco.

choco install gnuwin32-make.portable

choco upgrade gnuwin32-make.portable

Make your own mongo configuration file (.mongorc.js)

-In C:\Users\"computer-name"\

    touch .mongorc.js

    notepad .mongorc.js

    copy and paste this info in the file http://pastebin.com/EFi2xCr8

   (or just create a file in text editer copy and paste info and move to  C:\Users\"computer-name"\ )

That's it, mongo hacker is now installed and working and you can start MongoDB with the "mongod" command from the terminal.

Ross King
Ross King
22,165 Points

Thanks for this, it's working great.

Only problem now is that it has a ridiculously long filepath before the version number on my CLI, any idea how to remove this? Thanks

CLI

ryanjones6
ryanjones6
13,797 Points

[SOLVED] Installed - Using Cmder Application

Note: I installed cmder using the chocolatey package manager

Steps

  1. Make sure you are using cmd or powershell as Administrator
  2. Using choco: install MinGW
choco install mingw
  1. When prompted: [y]es | [n]o - Type: y
  2. Wait for it to install completely

  3. Close the cmder application

  4. Locate the MinGW installation directory. It might be...

C:\tools\mingw64
  1. Open open the bin directory
C:\tools\mingw64\bin
  1. Find the file: mingw32-make.exe -- you might not see the .exe unless you've enabled windows to display extensions.

  2. Make a copy of this file in the same directory and name it make.exe. So now you should have two files that do the exact same task.

mingw32-make.exe
make.exe
  1. Copy the the full path including the bin directory...
C:\tools\mingw64\bin
  1. Open your System Environment Variables
  2. In your System Propertie window. Make sure the Advanced is selected.
  3. Click on the Environment Variables.. button at the bottom of the tab.
  4. The Environment Variables window will pop-up. It will be broken into two windows:

    User variables for Administrator

    System variables

  5. In the second window, System variables locate the Path variable and select the Edit button.

  6. Click the New button and paste in the path to the mingw64 bin directory

  7. Click the OK button to confirm

  8. Clck OK again. And click OK again.

  9. Open cmder and type:

    gcc --version
    
  10. You should get an output telling you the version of MinGW

NodeJS -- is required to complete the next steps.

  1. Run cmder as Administator. Locate the little green + button. To the right of the button is a tiny down-arrow. Click the array and select: 1:{cmd} > 1:{Cmder as Admin}

  2. Now run the command:

npm install -g mongo-hacker
  1. It should install now. -- This is what I did

For further assistance refer to this stackoverflow comment...

Thanks for the clear instructions. All set up and running with mongo-hacker now.

I guess the author does not target windows at all. After installing the make package, I got this error:

cat config.js base.js hacks/aggregation.js hacks/api.js hacks/auto_complete.js hacks/cmd_search.js hacks/color.js hacks/common.js hacks/count.js hacks
/dbref.js hacks/find_and_modify.js hacks/helpers.js hacks/index_paranoia.js hacks/old_aggregation.js hacks/prompt.js hacks/randomise.js hacks/sh_statu
s.js hacks/show.js hacks/uuid.js hacks/verbose.js > mongo_hacker.js
'cat' is not recognized as an internal or external command,
Seth Kroger
Seth Kroger
56,413 Points

I'm really sorry. This is a known issue on Windows and the author still needs to work on it. https://github.com/TylerBrock/mongo-hacker/issues/138 You can try installing Make for Windows and add it to your PATH.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Oh well, sadly no luck but thanks for your response. :) Adding Make to the environment variables doesn't seem to have done the trick but I've added a comment on the thread asking about a timetable for fixing the issue.

Seth Kroger
Seth Kroger
56,413 Points

Yeah, it's a roll of the dice when that particular program (make for windows) hasn't been updated since XP was around.

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Yes I wasn't overly optimistic when i went to the website. But never mind, it's not essential i get Hacker installed but might be nice. :-)

After installing make for windows from here http://gnuwin32.sourceforge.net/packages/make.htm you just have to add make to the path. Then restart CMD and you are good to go!

Scott Cox
Scott Cox
12,219 Points

I had luck installing Mongo-Hacker by getting Make via Chocolatey. Check out: https://chocolatey.org/packages/gnuwin32-make.portable

does anyone know if this is safe? It seems to be directing to sourceforge.net download which I've heard isn't the most reputable site to download content

David Gilfillan
David Gilfillan
12,928 Points

I first installed Chocolatey via windows cmd prompt using the command:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Then to install make with choco i ran the following commands:

choco install gnuwin32-make.portable choco upgrade gnuwin32-make.portable

The npm install command then ran ok:

npm install -g mongo-hacker.

Note: to get the colours working (in cmder at least) I had to change the following settings in the .mongorc.js file:

force_color: true windows_warning: false

Tom Stanley
Tom Stanley
15,308 Points

Trying to install mongo-hacker on windows, I installed chocolatey and entered

choco install gnuwin32-make.portable & choco upgrade gnuwin32-make.portable

but npm i -g mongo-hacker still fails with

npm ERR! mongo-hacker@0.0.15 install: `make install`

npm ERR! Exit status 255

npm ERR!

npm ERR! Failed at the mongo-hacker@0.0.15 install script.

I'm stumped. Guess I buy a Mac?