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

Permission denied error trying to install Mongo-Hacker?

I am getting the attached error when trying to install Mongo-hacker. Has anyone else had similar issues or can see what is going wrong?

> mongo-hacker@0.0.15 install /usr/local/lib/node_modules/mongo-hacker
> make install

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/ps.js hacks/randomise.js hacks/sh_status.js hacks/show.js hacks/uuid.js hacks/verbose.js > mongo_hacker.js
INSTALLATION
Linking MongoHacker to .mongorc.js in your home directory:
mv: rename /Users/stephanierichter/.mongorc.js to /Users/stephanierichter/.mongorc.js.orig: Permission denied
Backed up ~/.mongorc.js.orig
ln -sf "/usr/local/lib/node_modules/mongo-hacker/mongo_hacker.js" ~/.mongorc.js
ln: /Users/stephanierichter/.mongorc.js: Permission denied
make: *** [install] Error 1
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "mongo-hacker"
npm ERR! node v4.6.0
npm ERR! npm  v2.15.9
npm ERR! code ELIFECYCLE

npm ERR! mongo-hacker@0.0.15 install: `make install`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mongo-hacker@0.0.15 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.15 postuninstall /usr/local/lib/node_modules/mongo-hacker
> make uninstall

rm -f ~/.mongorc.js
rm: /Users/stephanierichter/.mongorc.js: Permission denied
make: *** [uninstall] Error 1
npm WARN continuing anyway mongo-hacker@0.0.15 postuninstall: `make uninstall`
npm WARN continuing anyway Exit status 2

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/stephanierichter/npm-debug.log
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Out of curiosity (and I'm not sure this will work), but have you tried running the same commands using sudo? Quite often this will work. Hope you get this sorted out! :sparkles:

Nikolay Nogin
Nikolay Nogin
22,154 Points

I have the same problem, changing permission rights of node folder was not helpful, installing with sudo, got error above, then I tried without sudo, and it worked!

4 Answers

Unfortunately I've tried all of those except for installing using git clone. I've also developed a new issue after trying some of these where whenever I run mongo it includes an errno:2?

MongoDB shell version: 3.2.10
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
    http://docs.mongodb.org/
Questions? Try the support group
    http://groups.google.com/group/mongodb-user
2016-11-03T18:22:27.796-0400 I STORAGE  [main] In File::open(), ::open for '/Users/stephanierichter/.mongorc.js' failed with errno:2 No such file or directory
Server has startup warnings: 
2016-11-03T18:21:00.281-0400 I CONTROL  [initandlisten] 
2016-11-03T18:21:00.281-0400 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> 
Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Oh My...

What about trying with git clone approach. may be that will help?

Also how about suggestion of

sudo chown $USER /usr/local/lib/node_modules

That may help ...

The problems is that Mongo gives now that no such file /Users/stephanierichter/.mongorc.js exist

Which means, that probably because you could not install mongo-hacker, it screwed .mongorc.js file...

The question will be : does file /Users/stephanierichter/.mongorc.js exist ?

What is the output of command below : ?

ls -la /Users/stephanierichter/.mongorc.js

I cannot help you much remotely... The best way is to find a local person that can help you of course ...

If there is such a file, but mongo cannot find it, that is bad ... apparently you have to use the following person advice

http://stackoverflow.com/questions/22348604/the-mongorc-js-is-not-found-but-there-is-one

If file is not there, then you have to find it somewhere and copy to home directory ...

Again there is almost no way I can solve the problem remotely ...

At worst case ever, If nothing works, and no-one is there to help, what I would do, is to re-install mongo completely. Because I infer that it worked before you tried installing mongo-hacker , right ?

I have, this was the same response I got using sudo :(

Thanks Bruno Navarrete!