@mishavee If i keep the full connection string, it says: Could not find Node *, using Node 10.
Ohhh this sounds familiar! I think this might help you:
or, maybe (if your package.json isnât valid)
I agree with @househaunt.
In packages.json, if I set to the same as yours âŚ
"engines": {
"node": "*"
},
Then I get the same error Could not find node *, using 10
So try this instead âŚ
"engines": {
"node": "10.x"
},
You could also use â8.xâ or â12.xâ, depending on which version of Node you want to use.
Folks the âCould not find Node xâ message isnât really an error - itâs a confusingly-displayed warning telling you that weâre choosing a Node version for you since we couldnât figure out which one you wanted. Unless your projectâs code is Node version sensitive this isnât something to be concerned about.
@RobotFights @mishaveeâs suggestion will suffice to silence that message if itâs getting in the way, but it shouldnât affect how your code runs at all (unless, as I mentioned, you need something other than Node 10).
Thanks, that error is gone but now have another one saying: (node:6459) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
I did that and still saying not found. I think it has something to do with my MONGO_URI
I found that adding the following option to MongoClient.connect gets rid of the warning
useUnifiedTopology: true
Do you mean the Node engine warning?
When i try to pass the live app link to freecodecamp solution test. and how do i use the âuseUnifiedtopology: trueâ ? Cos already edited my code like this : mongoose.connect(process.env.MONGO_URI,{ useNewUrlParser: true });
Adding it to the options âŚ
mongoose.connect(process.env.MONGO_URI,{ useNewUrlParser: true, useUnifiedTopology: true });
Edited it to the code above, still not going. if thereâs another way for me to share my code since the live app link isnât working.
This is how you share a link to your project to look at the code, I can see it ⌠https://glitch.com/~fifth-blade
var mongodb = require('mongodb');
const mongoose = require('mongoose');
If youâre using mongoose
, you are unlikely to also need to use the mongodb
module. It shouldnât stop the code working though.
mongoose.connect(process.env.MONGO_URI,{ useNewUrlParser: true, useUnifiedTopology: true });
Your code is very similar to mine, I didnât need useUnifiedTopology for mongoose, for some reason.
My code âŚ
mongoose.connect(process.env.MONGODBURL, {useNewUrlParser: true});
Are you still getting a connection error in the console log?
Putting https://fifth-blade.glitch.me
in the browser returns Not Found
, this is because there are no routes setup yet, i.e. step 2 in the code is commented out.
Tried but still not workingâŚ