smus 1 Posted May 1, 2017 Report Share Posted May 1, 2017 I'm new to Node.js and MongoDB. I can't run Mongo on Node as it is explained here in w3 reference. There's an error 471 when I run 'node install mongodb' Quote Link to post Share on other sites
justsomeguy 1,135 Posted May 1, 2017 Report Share Posted May 1, 2017 I don't think Node has error codes like that, 471 is probably a line number or something. What is the actual error message? Have you installed the mongodb packages before trying to install them on Node? Quote Link to post Share on other sites
thescientist 231 Posted May 2, 2017 Report Share Posted May 2, 2017 You should be using NPM (which is what the example shows) https://www.w3schools.com/nodejs/nodejs_mongodb.asp $ npm install mongodb To elaborate, Node is the JavaScript runtime environment, NPM is the package manager. Using NPM to install Node packages for your project. Quote Link to post Share on other sites
smus 1 Posted May 2, 2017 Author Report Share Posted May 2, 2017 Quote Link to post Share on other sites
smus 1 Posted May 2, 2017 Author Report Share Posted May 2, 2017 11 hours ago, justsomeguy said: I don't think Node has error codes like that, 471 is probably a line number or something. What is the actual error message? Have you installed the mongodb packages before trying to install them on Node? Exactly! When I type "npm start" - this is the number of line in module.js file. There goes "Cannot find module 'express'" and then the same errors like in the previous message. Quote Link to post Share on other sites
dsonesuk 913 Posted May 2, 2017 Report Share Posted May 2, 2017 Program files is a protected directory, did you open command prompt by right clicking it and selecting 'run as administrator'. 1 Quote Link to post Share on other sites
smus 1 Posted May 2, 2017 Author Report Share Posted May 2, 2017 1 hour ago, dsonesuk said: Program files is a protected directory, did you open command prompt by right clicking it and selecting 'run as administrator'. Running as an admin: npm install mongodb - without errors npm start - the same error Quote Link to post Share on other sites
smus 1 Posted May 2, 2017 Author Report Share Posted May 2, 2017 No, I didn't install it. Now after npm install and npm install mongodb, npm start shows connection errors with mongodb - failed to connect to a server localhost:27017 Quote Link to post Share on other sites
dsonesuk 913 Posted May 2, 2017 Report Share Posted May 2, 2017 (edited) Depending on version you used, you have to create a db folder which will hold database data, and configure the path to that folder, I should check documentation for your version to identify proper procedure for configuring. A pc restart may be required. Edited May 2, 2017 by dsonesuk Quote Link to post Share on other sites
smus 1 Posted May 2, 2017 Author Report Share Posted May 2, 2017 I've no idea where to configure an address of the db folder. I've installed node.js using Windows installer (from *.msi file). But MongoDB has been installed manually from zip file. Quote Link to post Share on other sites
dsonesuk 913 Posted May 2, 2017 Report Share Posted May 2, 2017 Then where you got zip file MUST have documentation on how to setup database data folder? and configure on where this path should be placed, test it connects, and port to use. There are several ways to do this, apparently in programs folder, or on main drive under C:\ in it own folder. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.