Closed stefanocudini closed 5 years ago
Please do not run the install command as root. Install node + npm so that they don't require a root user to run.
run by user.. it's the same
user@myhost:~$ sudo npm install -g mongo-hacker
> mongo-hacker@0.0.15 install /usr/lib/node_modules/mongo-hacker
> make install
cat config.js base.js hacks/color.js hacks/common.js hacks/aggregation.js hacks/old_aggregation.js hacks/uuid.js hacks/find_and_modify.js hacks/prompt.js hacks/auto_complete.js hacks/dbref.js hacks/helpers.js hacks/cmd_search.js hacks/show.js hacks/ps.js hacks/verbose.js hacks/randomise.js hacks/api.js hacks/index_paranoia.js hacks/sh_status.js hacks/count.js > mongo_hacker.js
/bin/sh: 1: cannot create mongo_hacker.js: Permission denied
Makefile:10: recipe for target 'mongo_hacker.js' failed
make: *** [mongo_hacker.js] Error 2
npm ERR! code ELIFECYCLE
npm ERR! errno 2
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.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-09-05T18_14_56_276Z-debug.log
Ok thanks for the info, sorry you are having trouble. The user that you are running this as needs to have permission to write to the home directory. Make sure that this is the case.
/bin/sh: 1: cannot create mongo_hacker.js: Permission denied
Makefile:10: recipe for target 'mongo_hacker.js' failed
Probably a duplicate of #154
This worked for me:
$ sudo chmod 777 /usr/local/lib/node_modules
$ npm install -g mongo-hacker
$ sudo chmod 755 /usr/local/lib/node_modules
sudo npm install --global --unsafe-perm mongo-hacker
Post-install scripts are normally prohibited by root (for good reason); the --unsafe-perm
flag allows these scripts to run.
If you can, use NVM instead of installing Node directly, as NVM will let you run npm install --global
without sudo
.
On my Mac with NVM, npm install --global mongo-hacker
works fine 👍
thks @adamelliotfields
on Debian 8, Node v8.4.0, Npm v 5.3.0
run by root...