question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installation permission problems

See original GitHub issue

When I tried to install via npm, both installation and uninstall fails with permission errors. Even though I’m the root, script is not able to run as su. Trying with sudo also fails. Deleting current .mongorc.js file does not solve the problem.

> mongo-hacker@0.0.12 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/verbose.js hacks/api.js hacks/index_paranoia.js hacks/sh_status.js hacks/count.js > mongo_hacker.js
INSTALLATION
Linking MongoHacker to .mongorc.js in your home directory:
ln -sf "/usr/lib/node_modules/mongo-hacker/mongo_hacker.js" ~/.mongorc.js
ln: failed to access ‘/root/.mongorc.js’: Permission denied
Makefile:13: recipe for target 'install' failed
make: *** [install] Error 1
npm ERR! Linux 4.2.0-16-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "mongo-hacker"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! mongo-hacker@0.0.12 install: `make install`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mongo-hacker@0.0.12 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 their info via:
npm ERR!     npm owner ls mongo-hacker
npm ERR! There is likely additional logging output above.

> mongo-hacker@0.0.12 postuninstall /usr/lib/node_modules/mongo-hacker
> make uninstall

rm -f ~/.mongorc.js
rm: cannot remove ‘/root/.mongorc.js’: Permission denied
Makefile:27: recipe for target 'uninstall' failed
make: *** [uninstall] Error 1
npm WARN continuing anyway mongo-hacker@0.0.12 postuninstall: `make uninstall`
npm WARN continuing anyway Exit status 2

npm ERR! Please include the following file with any support request:
npm ERR!     /root/npm-debug.log

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12

github_iconTop GitHub Comments

11reactions
gyscoscommented, Oct 5, 2017

Apparently scripts are expected to be run as user nobody if npm is run as root. The nobody user doesn’t seem to have write access to the target directory, hence the error.

A solution is to run npm as a regular user, but with write access to the install directory:

$ mkdir -p /usr/local/lib/node_modules
$ sudo chmod 777 /usr/local/lib/node_modules
$ npm install -g mongo-hacker
$ sudo chmod 755 /usr/local/lib/node_modules

Editted to fix permissions afterward.

Note that it’s a pretty crappy hacky workaround, far from ideal from a security viewpoint. It shouldn’t be required, and is not a real solution to this issue.

6reactions
alx741commented, Mar 15, 2016

Same here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error 5, Access is Denied while installing software on ...
Fix Error 5, Access is Denied message when you try to install software on Windows 11/10 computer. You need to change permissions, etc....
Read more >
Permission issues when installing applications or games, after
I have been having permission issues when installing applications or games -even when running with elevated privileges that would mitigate ...
Read more >
Software Installation Failure - Access denied to Deploy Software
If you have used 'Run As' option while installing the software, ensure that the user has necessary privileges to access the path, to...
Read more >
Install Error: Permission to Install Was Denied - Veriato
Insufficient permissions or User Account Control (UAC) on a Windows device prevented remote installation. This could be a problem attempting deployment on a ......
Read more >
Big Sur Problem?: "You do not have… - Apple Developer
don't have permission to open the App, contact Your computer or network Administrator for assistance" Also it happens when I want to install...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found