简体   繁体   English

节点JS Heroku无法获取/

[英]Node JS Heroku Cannot GET /

my Procfile 我的Procfile

web: node web.js

my package.json 我的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"
  }
}

and my 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);

all my files are in the root directory , and there is no error when I run the grunt serve , the error remains only heroku ... 我所有的文件都在根目录中,运行grunt serve时没有错误,错误仅是heroku ...

I'm doing the deploy in heroku my machine with windows 7 and using powershell 我正在使用Windows 7和Powershell在Heroku我的机器中进行部署

What does heroku logs --tail say? heroku logs --tail说什么?

Based on all the grunt dependencies, I'm betting you're going to want to move grunt to dependencies from devDependencies (or heroku config:set NPM_CONFIG_PRODUCTION=false ). 基于所有grunt依赖关系,我devDependencies您将要从devDependencies (或heroku config:set NPM_CONFIG_PRODUCTION=false )将grunt移至dependencies devDependencies You'll also need to run your grunt build in postinstall: 您还需要在安装后运行grunt构建:

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

Heroku has a tutorial on this: Heroku对此有一个教程:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM