node js app在本地运行,但在heroku上显示奇怪

时间:2017-05-17 14:41:37

标签: angularjs node.js heroku

解决

我有nodejs应用程序在本地工作正常 how it's suppose to look

但是当使用heroku运行时,我所拥有的只是角撑

Total Registered Devices : {{deviceCount}}
{{ device.deviceName }} 
IMEI : {{ device.deviceId }} 
delete

日志没有错误

2017-05-17T14:00:37.000000+00:00 app[api]: Build started by user shira@bd-el.com 
2017-05-17T14:00:52.540172+00:00 app[api]: Release v11 created by user shira@bd-el.com 
2017-05-17T14:00:52.540172+00:00 app[api]: Deploy d1f297f by user shira@bd-el.com 
2017-05-17T14:00:53.110060+00:00 heroku[web.1]: State changed from down to starting 
2017-05-17T14:00:37.000000+00:00 app[api]: Build succeeded
2017-05-17T14:00:55.758955+00:00 heroku[web.1]: Starting process with command `node server.js` 
2017-05-17T14:01:00.294554+00:00 heroku[web.1]: State changed from starting     to up 2017-05-17T14:01:00.794336+00:00 app[web.1]: 7163 is the magic port
2017-05-17T14:01:01.254442+00:00 app[web.1]: db is open
2017-05-17T14:01:01.258895+00:00 app[web.1]: db is mongodb://heroku_090x9gxv:rkk64dlhd8mifkd08og359ti44@ds143181.mlab.com:43181/heroku_090x9gxv 
2017-05-17T14:02:04.932689+00:00 heroku[router]: at=info method=GET path="/" host=afternoon-stream-95096.herokuapp.com request_id=753b228e-ed70-474e-a0f1-8c3001ba980f fwd="185.3.147.160" dyno=web.1 connect=0ms service=80ms status=200 bytes=2732 protocol=https 
2017-05-17T14:02:05.197980+00:00 heroku[router]: at=info method=GET path="/main.js" host=afternoon-stream-95096.herokuapp.com request_id=13faf8b3-8c86-4e2f-9787-2912b6b50816 fwd="185.3.147.160" dyno=web.1 connect=0ms service=20ms status=200 bytes=3211 protocol=https

我的package.json文件是 -

{
  "name": "nodejs-web-app1",
  "version": "0.0.0",
  "description": "NodejsWebApp1",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "author": {
    "name": "ddfps"
  },
  "dependencies": {
    "body-parser": "^1.17.1",
    "ejs": "^2.5.6",
    "express": "^4.15.2",
    "mongoose": "^4.9.9",
    "morgan": "^1.8.1",
    "node-gcm": "^0.14.6",
    "socket.io": "^1.7.4"
  }
}

编辑:控制台日志

> Blocked loading mixed active content
> “http://fonts.googleapis.com/icon?family=Material+Icons”[Learn More]
> afternoon-stream-95096.herokuapp.com Blocked loading mixed active
> content
> “http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.css”[Learn
> More] afternoon-stream-95096.herokuapp.com Blocked loading mixed
> active content
> “http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular.min.js”[Learn
> More] afternoon-stream-95096.herokuapp.com Blocked loading mixed
> active content
> “http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-animate.min.js”[Learn
> More] afternoon-stream-95096.herokuapp.com Blocked loading mixed
> active content
> “http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-aria.min.js”[Learn
> More] afternoon-stream-95096.herokuapp.com Blocked loading mixed
> active content
> “http://ajax.googleapis.com/ajax/libs/angularjs/1.5.3/angular-messages.min.js”[Learn
> More] afternoon-stream-95096.herokuapp.com Blocked loading mixed
> active content
> “http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0-rc2/angular-material.min.js”[Learn
> More] afternoon-stream-95096.herokuapp.com ReferenceError: angular is
> not defined[Learn More]

或简称 - 未定义角度。 什么可能导致问题?

p.s我在通过cloud.9时遇到了完全相同的错误。

编辑2 - 解决方案 angular没有被定义,因为它的href是http,而heroku是在https上运行的,导致无法加载包。 我从href中删除了'http:',这解决了问题。

0 个答案:

没有答案