javascript - Node JS Heroku 无法 GET/

标签 javascript node.js heroku

我的Proc文件

web: node web.js

我的package.json

{
  "name": "tattoohipfront",
  "private": true,
  "devDependencies": {
    "autoprefixer-core": "^5.2.1",
    "grunt": "^0.4.5",
    "grunt-angular-templates": "^0.5.7",
    "grunt-concurrent": "^1.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-compass": "^1.0.0",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-connect": "^0.9.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-cssmin": "^0.12.0",
    "grunt-contrib-htmlmin": "^0.4.0",
    "grunt-contrib-imagemin": "^1.0.0",
    "grunt-contrib-jshint": "^0.11.0",
    "grunt-contrib-uglify": "^0.7.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^2.1.2",
    "grunt-google-cdn": "^0.4.3",
    "grunt-jscs": "^1.8.0",
    "grunt-newer": "^1.1.0",
    "grunt-ng-annotate": "^0.9.2",
    "grunt-postcss": "^0.5.5",
    "grunt-svgmin": "^2.0.0",
    "grunt-usemin": "^3.0.0",
    "grunt-wiredep": "^2.0.0",
    "jit-grunt": "^0.9.1",
    "time-grunt": "^1.0.0",
    "jshint-stylish": "^1.0.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "dependencies": {
    "express": "^4.13.4",
    "gzippo": "^0.2.0"

  },
  "scripts": {
    "start": "node web.js"
  }
}

和我的 web.js

var gzippo = require('gzippo');
  var express = require('express');
  var app = express();

  app.use(gzippo.staticGzip("" + __dirname + "/dist"));
  app.listen(process.env.PORT || 5000);

我的所有文件都在根目录下,运行gruntserve时没有错误,错误仍然只有heroku...

我正在使用 Windows 7 并使用 powershell 在我的 Heroku 机器中进行部署

最佳答案

heroku log --tail 说什么?

基于所有 grunt 依赖项,我打赌您会想要将 grunt 从 devDependencies (或 heroku config:set NPM_CONFIG_PRODUCTION=false)。您还需要在安装后运行 grunt 构建:

"scripts": {
  "postinstall": "grunt build"
}

Heroku 有一个关于此的教程:

https://devcenter.heroku.com/articles/node-with-grunt

关于javascript - Node JS Heroku 无法 GET/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35671328/

相关文章:

ruby-on-rails - Heroku "We' 很抱歉,但在 Postgres 迁移后出了点问题

python - 是否可以在 Heroku dynos 上刷新内存?

javascript - 如何将 extjs 标记字段作为数组发布而不用引号引起来

javascript - 我应该使用什么语言来创建像 Weebly 这样的拖放功能?

node.js - 如何在 Firebase 上运行 Node.js 脚本?

mysql - 变量作为 node.js mysql 中的表名

node.js - Heroku 上的 "Self signed certificate"错误运行 sequelize db :migrate

javascript - 使用 JavaScript 将 DOM 元素添加到 Body 的最佳方式

javascript - 无法从 javascript 访问 ViewBag(有一个 JSON 对象列表)

javascript - 错误: Corrupted zip : can't find end of central directory - XLSX