When I try to run the app, I get an error like the one below :/ which is annoying as it's a dependency. Anyone know what to do about that?
TypeError: Cannot use 'in' operator to search for 'autoCreate' in true
at NativeConnection.Connection.openUri (/Users/vhu02/Documents/Apprentice_work/node-react-starter/node_modules/mongoose/lib/connection.js:561:22)
at Mongoose.connect (/Users/vhu02/Documents/Apprentice_work/node-react-starter/node_modules/mongoose/lib/index.js:332:15)
at Object. (/Users/vhu02/Documents/Apprentice_work/node-react-starter/index.js:11:10)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
[nodemon] app crashed - waiting for file changes before starting...
I did try that as the other comment addressed it and it didn't seem to work.
the exact error I'm getting is this:
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.
events.js:183
throw er; // Unhandled 'error' event
When I try to run the app, I get an error like the one below :/ which is annoying as it's a dependency. Anyone know what to do about that?
TypeError: Cannot use 'in' operator to search for 'autoCreate' in true
at NativeConnection.Connection.openUri (/Users/vhu02/Documents/Apprentice_work/node-react-starter/node_modules/mongoose/lib/connection.js:561:22)
at Mongoose.connect (/Users/vhu02/Documents/Apprentice_work/node-react-starter/node_modules/mongoose/lib/index.js:332:15)
at Object. (/Users/vhu02/Documents/Apprentice_work/node-react-starter/index.js:11:10)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
[nodemon] app crashed - waiting for file changes before starting...
Hey Veronika,
Could you share the code that reproduces this error, please?
There is nothing much to share as I just followed these steps haha
OMG really? haha
I just download the source code and tested it here. Everything works fine.
Could you try to clone the repo and test it just in case?
yeah so I forked your Github, and the proxy still isn't working. I seem to get a deprecation error
What you could try to do is to add the following line in your client/package.json file:
"proxy": "localhost:5000"
That should solve the problem.
I did try that as the other comment addressed it and it didn't seem to work.
the exact error I'm getting is this:
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.
events.js:183
throw er; // Unhandled 'error' event
Veronika,
Does the error persist once you modify the line:
mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/node-react-starter',{ useNewUrlParser: true });
as suggested by the Deprecation Warning?
What is the prompt error if so?
This deprecation warning should not prevent you from running the app, but the rpacheco suggestion should do the trick.
You can also add this config on another line, like so:
mongoose.set("useNewUrlParser", true);
You might also find other deprecation warnings in the future, follow a list below in case you need it.
mongoose.set("useFindAndModify", false);
mongoose.set("useCreateIndex", true);
mongoose.set("useUnifiedTopology", true);
Let me know if that worked for you.
For the proxy issue follow the steps below.
Replace the ' const proxy' in setupProxy.js file with this.
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use('/api',
createProxyMiddleware({
target: 'localhost:5000',
changeOrigin: true
})
);
};
it works. You can follow . Please let me know here