简体   繁体   中英

When I run nodemon server I get the error "bad auth Authentication failed. [nodemon] app crashed - waiting for file changes before starting..."

I have been working on a node.js / react app and I uploaded it to heroku. About a month ago it worked (locally and on heroku). Now it doesn't. I seem to get the same error when I run nodemon server even when I download old commits of the app (which did work). Terminal does this:

TDI-MacBook-Air:udemy-MERN-FromGithub bob$ nodemon server
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server started on Port 5000
bad auth Authentication failed.
[nodemon] app crashed - waiting for file changes before starting...

1. downloaded old an old commit from my githum https://github.com/PaulAyling/COURSE-MernStackFrontToBack

2. ran at the terminal: npm install

3. Ran at terminal nodemon server (got the same error as before).

4. I tried connecting to the mongo database with postman and got the following error:

Could not get any response
There was an error connecting to http://localhost:5000/api/posts.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General

After reading the error I changed the SSL Certificate verification to off but it did not fix the problem

Theres quite alot of code - not sure what the most usefull files would be - but it did work a month ago.

The full code is here: https://github.com/PaulAyling/COURSE-MernStackFrontToBack

If you want specific code let me know and I'll post it.

Expecting the server to run. Error is;

TDI-MacBook-Air:udemy-MERN-FromGithub bob$ nodemon server
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server started on Port 5000
bad auth Authentication failed.
[nodemon] app crashed - waiting for file changes before starting...

In your /config/default.json or /config/production.json there is an object mongoURI .

Replace the url with with user password and username not your account name and account password that currently functions.

You have probably deleted that user or changed the password.

Also I tried launching in my local machine and it worked without any trouble.

在此输入图像描述

If your username has special characters then change the username with URL encoded format. you will find URL encoding here !

I will recommend changing the password to eliminate special chars.

As per the Mongo DB website :

Special Characters in Connection String Password

If your password includes special characters, and you are using your password in a connection string URI, encode the special characters.

NOTE

The following characters must be converted using percent-encoding if included in a username or password:

: /? # [ ] @

For example, if your password in plain text is p@ssw0rd'9',: you need to encode your password as:

p%40ssw0rd%279%27%21

The above solution worked for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM