Trying to install mongodb or mongoose globally results in a missing peer dependency for Kerberos
Jamess-MacBook-Pro:ka2 jamessherry$ npm install -g mongodb
/usr/local/lib
└─┬ [email protected]
└── UNMET PEER DEPENDENCY kerberos@~0.0
npm WARN EPEERINVALID [email protected] requires a peer of kerberos@~0.0 but none was installed.
Jamess-MacBook-Pro:ka2 jamessherry$ npm install -g mongodb
- [email protected] node_modules/mongodb/node_modules/kerberos/node_modules/nan
- [email protected] node_modules/mongodb/node_modules/kerberos
/usr/local/lib
└─┬ [email protected]
└── UNMET PEER DEPENDENCY kerberos@~0.0
npm WARN EPEERINVALID [email protected] requires a peer of kerberos@~0.0 but none was installed.
Jamess-MacBook-Pro:ka2 jamessherry$ npm install -g mongoose
/usr/local/lib
└─┬ [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── UNMET PEER DEPENDENCY kerberos@~0.0
│ ├── [email protected]
│ └─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
npm WARN EPEERINVALID [email protected] requires a peer of kerberos@~0.0 but none was installed.
Does anyone know how to go about fixing that? If you manually install then you have to do that on every update.
Also, I can't find a place to report the bug...
I just had to run npm install --save kerberos mongodb
to successfully install mongodb in my project. I assume you can do it globally as well, but there may be other issues.
From the mongodb NPM package docs:
The kerberos package is a C++ extension that requires a build environment to be installed on your system. You must be able to build node.js itself to be able to compile and install the kerberos module. Furthermore the kerberos module requires the MIT Kerberos package to correctly compile on UNIX operating systems. Consult your UNIX operation system package manager what libraries to install.
It goes on to offer the following steps for diagnosing the issue on UNIX-based operating systems:
If you don’t have the build essentials it won’t build. In the case of linux you will need gcc and g++, node.js with all the headers and python. The easiest way to figure out what’s missing is by trying to build the kerberos project. You can do this by performing the following steps.
git clone https://github.com/christkv/kerberos.git
cd kerberos
npm install
If all the steps complete you have the right toolchain installed. If you get node-gyp not found you need to install it globally by doing.
npm install -g node-gyp
If correctly compiles and runs the tests you are golden. We can now try to install the mongod driver by performing the following command.
cd yourproject
npm install mongodb --save
If it still fails the next step is to examine the npm log. Rerun the command but in this case in verbose mode.
npm --loglevel verbose install mongodb
This will print out all the steps npm is performing while trying to install the module.
Other possible issues:
Your python installation might be hosed making gyp break. I always recommend that you test your deployment environment first by trying to build node itself on the server in question as this should unearth any issues with broken packages (and there are a lot of broken packages out there).
Another thing is to ensure your user has write permission to wherever the node modules are being installed.