First, express and supervisor are installed
In package.json:
"scripts": {
"start": "supervisor ./bin/www"
},
Run NPM start in the command window under the root directory of the project
But the results are as follows:
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.
Port 3000 is already in use…
The solutions to the above two problems are as follows:
(1) Solution to the problem of URL string parsing: when mongoose connects to the database, two parameters are added in addition to the URL parameter, as follows:
mongoose.connect("mongodb://127.0.0.1:27017/test",{useNewUrlParser:true},function(err){
if(err){
console.log('Connection Error:' + err)
}else{
console.log('Connection success!')}
});
(2) The solution to the occupation of the port number: first, make sure that the same port number can not open two items at the same time, then check whether the command is written correctly, and finally check whether the computer has installed software similar to Baidu antivirus, uninstall the software and then re-run the command to restore normal
Similar Posts:
- Mongodb access control is not enabled for the database
- Linux transport error 202: bind failed: Address already in use
- unix:///tmp/supervisor.sock no such file
- Solve Error: MissingSchemaError: Schema hasn’t been registered for model “YourModel”.
- Several ports (8005, 8080, 8009) required by Tomcat Server at localhost are already in use.
- Rabbitmq error of connecting the native idea to Linux: java.net.connectexception: connection timed out: Connect [Solved]
- The ADB command installs APK, and the installation problem is solved by daemon not running. Starting it now on port 5037
- How to Solve Android wireless debug Error
- Apache : Error: Apache shutdown unexpectedly [How to Solve]
- How to Solve error: Unexpected console statement (no-console)