Heroku "NPM_CONFIG_LOGLEVEL=error" - need guidance please


https://timestampapiforfcc.herokuapp.com

I keep getting “Application Error” when I run my Heroku app for the timestamp service.

The only thing that keeps popping up in the Heorku log is “NPM_CONFIG_LOGLEVEL=error” (entire latest log is appended to the bottom of this missive)

At first I thought Heroku was choking on the port, so I fixed that and still got the error.

After continued reading, I have come to think there is something not quite right with the json package. But after several updates, I am still getting the same darn error.

Any suggestions, fellow campers?

-----> Node.js app detected
-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NPM_CONFIG_PRODUCTION=true
   NODE_ENV=production
   NODE_MODULES_CACHE=true

-----> Installing binaries
engines.node (package.json): 4.6.1
engines.npm (package.json): unspecified (use default)

   Downloading and installing node 4.6.1...
   Using default npm version: 2.15.9

-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules (not cached - skipping)
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json)
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules (nothing to cache)
- bower_components (nothing to cache)
-----> Build succeeded!
└── (empty)

-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing…
Done: 11.7M
-----> Launching…
Released v9
https://timestampapiforfcc.herokuapp.com/ deployed to Heroku

Your package.json is missing dependencies.

var express = require ('express');
var moment = require('moment');

You are requiring express and moment, but they are not in package.json

Thank you for your reply, but I am confused. Those are both already in the code. If they are also supposed to be in the json package, what you have shown me is not json format.

Please elaborate.

When you upload your project to Heroku, it goes through package.json file and install all necessary dependencies listed in that file. Your package.json doesn’t have any.

What I showed you is the part of your code where you require external dependencies, not included in node.js. You must include them as dependencies in package.json.

How did you get express and moment on your computer?

I did not put them on my actual computer, if I am understanding how c9 works. Rather, from the c9 terminal I did $npm install express and $ npm install moment

Hmmmm…

Just updated my json package and am still getting the same error, "NPM_CONFIG_LOGLEVEL=error"
but the HEROKU APP IS NOW WORKING!!!

{
“name”: “timestamp”,
“version”: “1.0.0”,
“dependencies”: {
“express”: “^4.14.0”,
“moment”: “^2.15.1”
},
“engines”: {
“node”: “4.6.1”
},
“description”: “this is the timestamp challenge for FCC”,
“main”: “server.js”,
“scripts”: {
“start”: “node server.js”
},
“author”: “john gillespie”,
“license”: “UNLICENSED”
}

Why do you think this is error? To me it seems that log level is set to show only errors.

Ah, I saw “=error” and thought it was telling me there was some kind of error. Thank you again for your assistance with this!