smus Posted May 1, 2017 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' Link to comment Share on other sites More sharing options...
justsomeguy Posted May 1, 2017 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? Link to comment Share on other sites More sharing options...
thescientist Posted May 2, 2017 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. Link to comment Share on other sites More sharing options...
smus Posted May 2, 2017 Author Share Posted May 2, 2017 Link to comment Share on other sites More sharing options...
smus Posted May 2, 2017 Author 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. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 2, 2017 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 Link to comment Share on other sites More sharing options...
smus Posted May 2, 2017 Author 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 Link to comment Share on other sites More sharing options...
smus Posted May 2, 2017 Author 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 Link to comment Share on other sites More sharing options...
dsonesuk Posted May 2, 2017 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 Link to comment Share on other sites More sharing options...
smus Posted May 2, 2017 Author 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. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 2, 2017 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now