troubleshooting Question

Why will this site not come up?

Avatar of Bruce Gust
Bruce GustFlag for United States of America asked on
JavaScriptNode.js
7 Comments1 Solution171 ViewsLast Modified:
Here's what my console says:

b.gust@AHA-DT-BGUST2 MINGW64 /c/wamp64/www/bsmart (new-activity-stream)
$ npm start

> cams@1.0.0 start C:\wamp64\www\bsmart
> sh ./bin/start.sh

(node:6392) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
User and company already exist: {"_id":"5e2a0b8b374a731400c45b9b"}
You may log in with email accounts@appliedhealth.net and password C@tch0fTheDay!
Start making of the Form 5500 Collections.
Time to build a Saved Import.
Attempting to create all F_5500 collections.
(node:38084) UnhandledPromiseRejectionWarning: MongoWriteConcernError: No write concern mode named 'majority/dev-bsmart-bgust' found in replica set configuration
    at MessageStream.messageHandler (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\connection.js:256:20)
    at MessageStream.emit (events.js:210:5)
    at processIncomingData (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\message_stream.js:144:12)
    at MessageStream._write (C:\wamp64\www\bsmart\node_modules\mongodb\lib\cmap\message_stream.js:42:5)
    at doWrite (_stream_writable.js:431:12)
    at writeOrBuffer (_stream_writable.js:415:5)
    at MessageStream.Writable.write (_stream_writable.js:305:11)
    at TLSSocket.ondata (_stream_readable.js:727:22)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at TLSSocket.Readable.push (_stream_readable.js:224:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)
(node:38084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:38084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My config file says that my URL should be localhost:4040

/* eslint-disable no-process-env */
const { Joi } = require('celebrate');

// require and configure dotenv, will load vars in .env in PROCESS.ENV
require('dotenv').config();

// define validation for all the env vars
const envVarsSchema = Joi.object({
  NODE_ENV: Joi.string()
    .valid('development', 'production', 'test', 'provision')
    .default('production'),
  PORT: Joi.number().default(4040),
  MONGODB_URI: Joi.string()
    .required()
    .description('Mongo DB host url'),
  MONGODB_PORT: Joi.number().default(27017),
  MONGODB_DATABASE: Joi.string()
    .required()
    .description('Mongo DB database'),
  MONGODB_READ_PREFERENCE: Joi.string()
    .required()
    .default('PRIMARY_PREFERRED'),
  SESSION_SECRET: Joi.string().required(),
  GOOGLE_MAP_KEY: Joi.string().required(),
  JWT_SECRET: Joi.string().required(),
  SMTP_HOST: Joi.string().required(),
  SMTP_PORT: Joi.number().required(),
  SMTP_POOL: Joi.string().required(),
  RESET_LINK: Joi.string().required(),
  SMTP_SENDER_ADDRESS: Joi.string().required(),
  DEV_AWS_ACCESS_KEY_ID: Joi.string().required(),
  DEV_AWS_SECRET_ACCESS_KEY: Joi.string().required(),
  AWS_ACCESS_KEY_ID: Joi.string().required(),
  AWS_SECRET_ACCESS_KEY: Joi.string().required(),
  USER_RETRIES: Joi.number().required(),
  USER_MIN_WAIT: Joi.number().required(),
  USER_MAX_WAIT: Joi.number().required(),
  GLOBAL_FREE_RETRIES: Joi.number().required(),
  GLOBAL_MIN_WAIT: Joi.number().required(),
  GLOBAL_MAX_WAIT: Joi.number().required(),
  GLOBAL_LIFETIME: Joi.number().required(),
  ATTACH_RESET_TO_REQUEST: Joi.string().required(),
  REFRESH_TIMEOUT_ON_REQUEST: Joi.string().required(),
  PASSWORD_MIN_LENGTH: Joi.number().required(),
  SMTP_LINK_EXPIRES_NUMBER: Joi.number().required(),
  SMTP_LINK_EXPIRES_PERIOD: Joi.string().required()
})
  .unknown()
  .required();

const { error, value: envVars } = envVarsSchema.validate(process.env);
if (error) {
  throw new Error(`Config validation error: ${error.message}`);
}

const config = {
  env: envVars.NODE_ENV,
  port: envVars.PORT,
  mongo: {
    uri: envVars.MONGODB_URI,
    port: envVars.MONGODB_PORT,
    database: envVars.MONGODB_DATABASE,
    readPreference: envVars.MONGODB_READ_PREFERENCE
  },
  sessionSecret: envVars.SESSION_SECRET,
  googleMapKey: envVars.GOOGLE_MAP_KEY,
  jwtSecret: envVars.JWT_SECRET,
  jwtExpiresIn: envVars.JWT_EXPIRES_IN,
  passwordMinLength: envVars.PASSWORD_MIN_LENGTH,
  smtp: {
    host: envVars.SMTP_HOST,
    port: envVars.SMTP_PORT,
    awsAccessKeyId: envVars.AWS_ACCESS_KEY_ID,
    awsSecretAccessKey: envVars.AWS_SECRET_ACCESS_KEY,
    devAwsAccessKeyId: envVars.DEV_AWS_ACCESS_KEY_ID,
    devAwsSecretAccessKey: envVars.DEV_AWS_SECRET_ACCESS_KEY,
    senderAddress: envVars.SMTP_SENDER_ADDRESS,
    resetLink: envVars.RESET_LINK,
    momentAddNumber: envVars.SMTP_LINK_EXPIRES_NUMBER,
    momentAddPeriod: envVars.SMTP_LINK_EXPIRES_PERIOD
  },
  userBruteForce: {
    freeRetries: envVars.USER_RETRIES,
    minWait: envVars.USER_MIN_WAIT,
    maxWait: envVars.USER_MAX_WAIT
  },
  globalBruteForce: {
    freeRetries: envVars.GLOBAL_FREE_RETRIES,
    minWait: envVars.GLOBAL_MIN_WAIT,
    maxWait: envVars.GLOBAL_MAX_WAIT,
    lifeTime: envVars.GLOBAL_LIFETIME,
    attachResetToRequest: envVars.ATTACH_RESET_TO_REQUEST
  }
};

module.exports = config;

So, I'm on my browser, I type in http://localhost:4040 and...

This site can’t be reachedlocalhost refused to connect.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED


Is there anything that I'm missing?

Does the content from my console explain why my site won't even come up?  Am I on the wrong port?

Why can i not see the site?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros