Steven Jirjis Steven Jirjis - 1 year ago 98
Node.js Question

Heroku Node app Error: Registry returned 404

The app runs fine locally, and builds successfully in Heroku, but fails to load when launching the app. I've successfully deployed a couple Heroku app in the past but am really confused why this won't launch. I hope the following is helpful, happy to post more if needed.

Here's the app: https://sugarmamas.herokuapp.com/

package.json

{
"name": "sugar-mamas",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sjirjis/sugarMamas.git"
},
"author": "Steven Jirjis",
"license": "ISC",
"bugs": {
"url": "https://github.com/sjirjis/sugarMamas/issues"
},
"homepage": "https://github.com/sjirjis/sugarMamas#readme",
"dependencies": {
"bcryptjs": "*",
"body-parser": "^1.18.1",
"connect-mongo": "^1.3.2",
"cookie-parser": "^1.4.1",
"express": "^4.15.4",
"express-flash": "0.0.2",
"express-handlebars": "^3.0.0",
"express-session": "*",
"express-validator": "*",
"mongodb": "*",
"mongoose": "*",
"passport": "*",
"passport-local": "*"
}
}


npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'bugs',
1 verbose cli 'sugar-mamas' ]
2 info using [email protected]
3 info using [email protected]
4 silly fetchPackageMetaData sugar-mamas
5 silly fetchNamedPackageData sugar-mamas
6 silly mapToRegistry name sugar-mamas
7 silly mapToRegistry using default registry
8 silly mapToRegistry registry https://registry.npmjs.org/
9 silly mapToRegistry data Result {
9 silly mapToRegistry raw: 'sugar-mamas',
9 silly mapToRegistry scope: null,
9 silly mapToRegistry escapedName: 'sugar-mamas',
9 silly mapToRegistry name: 'sugar-mamas',
9 silly mapToRegistry rawSpec: '',
9 silly mapToRegistry spec: 'latest',
9 silly mapToRegistry type: 'tag' }
10 silly mapToRegistry uri https://registry.npmjs.org/sugar-mamas
11 verbose request uri https://registry.npmjs.org/sugar-mamas
12 verbose request no auth needed
13 info attempt registry request try #1 at 5:42:19 PM
14 verbose request id bf45e3acd10b0a1c
15 http request GET https://registry.npmjs.org/sugar-mamas
16 http 404 https://registry.npmjs.org/sugar-mamas
17 verbose headers { 'content-type': 'application/json',
17 verbose headers 'cache-control': 'max-age=0',
17 verbose headers 'content-length': '2',
17 verbose headers 'accept-ranges': 'bytes',
17 verbose headers date: 'Sat, 30 Sep 2017 00:42:19 GMT',
17 verbose headers via: '1.1 varnish',
17 verbose headers age: '0',
17 verbose headers connection: 'keep-alive',
17 verbose headers 'x-served-by': 'cache-sjc3130-SJC',
17 verbose headers 'x-cache': 'MISS',
17 verbose headers 'x-cache-hits': '0',
17 verbose headers 'x-timer': 'S1506732139.318375,VS0,VE202',
17 verbose headers vary: 'Accept-Encoding' }
18 silly get cb [ 404,
18 silly get { 'content-type': 'application/json',
18 silly get 'cache-control': 'max-age=0',
18 silly get 'content-length': '2',
18 silly get 'accept-ranges': 'bytes',
18 silly get date: 'Sat, 30 Sep 2017 00:42:19 GMT',
18 silly get via: '1.1 varnish',
18 silly get age: '0',
18 silly get connection: 'keep-alive',
18 silly get 'x-served-by': 'cache-sjc3130-SJC',
18 silly get 'x-cache': 'MISS',
18 silly get 'x-cache-hits': '0',
18 silly get 'x-timer': 'S1506732139.318375,VS0,VE202',
18 silly get vary: 'Accept-Encoding' } ]
19 silly fetchPackageMetaData Error: Registry returned 404 for GET on https://registry.npmjs.org/sugar-mamas
19 silly fetchPackageMetaData at makeError (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:302:12)
19 silly fetchPackageMetaData at CachingRegistryClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:280:14)
19 silly fetchPackageMetaData at Request._callback (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:210:14)
19 silly fetchPackageMetaData at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:187:22)
19 silly fetchPackageMetaData at emitTwo (events.js:106:13)
19 silly fetchPackageMetaData at Request.emit (events.js:191:7)
19 silly fetchPackageMetaData at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1048:10)
19 silly fetchPackageMetaData at emitOne (events.js:96:13)
19 silly fetchPackageMetaData at Request.emit (events.js:188:7)
19 silly fetchPackageMetaData at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:969:12)
19 silly fetchPackageMetaData error for sugar-mamas { Error: Registry returned 404 for GET on https://registry.npmjs.org/sugar-mamas
19 silly fetchPackageMetaData at makeError (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:302:12)
19 silly fetchPackageMetaData at CachingRegistryClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:280:14)
19 silly fetchPackageMetaData at Request._callback (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:210:14)
19 silly fetchPackageMetaData at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:187:22)
19 silly fetchPackageMetaData at emitTwo (events.js:106:13)
19 silly fetchPackageMetaData at Request.emit (events.js:191:7)
19 silly fetchPackageMetaData at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1048:10)
19 silly fetchPackageMetaData at emitOne (events.js:96:13)
19 silly fetchPackageMetaData at Request.emit (events.js:188:7)
19 silly fetchPackageMetaData at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:969:12) pkgid: 'sugar-mamas', statusCode: 404, code: 'E404' }
20 verbose stack Error: Registry returned 404 for GET on https://registry.npmjs.org/sugar-mamas
20 verbose stack at makeError (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:302:12)
20 verbose stack at CachingRegistryClient.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:280:14)
20 verbose stack at Request._callback (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\request.js:210:14)
20 verbose stack at Request.self.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:187:22)
20 verbose stack at emitTwo (events.js:106:13)
20 verbose stack at Request.emit (events.js:191:7)
20 verbose stack at Request.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:1048:10)
20 verbose stack at emitOne (events.js:96:13)
20 verbose stack at Request.emit (events.js:188:7)
20 verbose stack at IncomingMessage.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\request\request.js:969:12)
21 verbose statusCode 404
22 verbose pkgid sugar-mamas
23 verbose cwd C:\Users\Steven\Documents\repo\sugarMamas
24 error Windows_NT 10.0.15063
25 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "bugs" "sugar-mamas"
26 error node v6.11.3
27 error npm v3.10.10
28 error code E404
29 error 404 Registry returned 404 for GET on https://registry.npmjs.org/sugar-mamas
30 error 404
31 error 404 'sugar-mamas' is not in the npm registry.
32 error 404 You should bug the author to publish it (or use the name yourself!)
33 error 404 Note that you can also install from a
34 error 404 tarball, folder, http url, or git url.
35 verbose exit [ 1, true ]


heroku logs

2017-09-30T01:03:55.948191+00:00 app[web.1]: npm ERR! npm bugs sugar-mamas
2017-09-30T01:03:55.948408+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2017-09-30T01:03:55.948603+00:00 app[web.1]: npm ERR! npm owner ls sugar-mamas
2017-09-30T01:03:55.948772+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2017-09-30T01:03:55.982578+00:00 app[web.1]:
2017-09-30T01:03:55.982972+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-09-30T01:03:55.983509+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2017-09-30T01:03:56.121697+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-30T01:03:56.106441+00:00 heroku[web.1]: Process exited with status 1
2017-09-30T01:03:58.898234+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sugarmamas.herokuapp.com request_id=f4d1ba9c-624c-421a-b0f0-c7d19e33b265 fwd="68.8.68.62" dyno= connect= service= status=503 bytes= protocol=https
2017-09-30T01:03:59.572539+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sugarmamas.herokuapp.com request_id=0c5e3f2e-c13f-4094-bea4-76db2deec1ea fwd="68.8.68.62" dyno= connect= service= status=503 bytes= protocol=https

Answer Source

It appears to me that you are trying to connect to a local version of your mongo database and need to have a remote setup.

mongoose.connect('mongodb://localhost/SugarMamas');

Will need to updated to be pointing to a remote database when you deploy.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download