Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 在Heroku上部署Grunt应用程序。。。还有什么';下一个是什么?。。。我的应用程序没有';开始_Node.js_Heroku_Gruntfile - Fatal编程技术网

Node.js 在Heroku上部署Grunt应用程序。。。还有什么';下一个是什么?。。。我的应用程序没有';开始

Node.js 在Heroku上部署Grunt应用程序。。。还有什么';下一个是什么?。。。我的应用程序没有';开始,node.js,heroku,gruntfile,Node.js,Heroku,Gruntfile,我有一个带有GrunFile的基本节点应用程序,我在部署时遇到了一些麻烦。所以我做了一个新的咕噜任务,做了一些改变。 那么部署就可以了 但现在当我去我的应用程序。我有一张空白页。 它不会加载appConfig.app目录 我可能错过了一些我想不出来的大事。我原以为grunt connect会完成连接,但似乎server.js在等待什么 NB:我想我不需要快递 以下是不同的文件: Grunfile.js server.js package.js Grunfile.js package.json

我有一个带有GrunFile的基本节点应用程序,我在部署时遇到了一些麻烦。所以我做了一个新的咕噜任务,做了一些改变。 那么部署就可以了

但现在当我去我的应用程序。我有一张空白页。 它不会加载appConfig.app目录

我可能错过了一些我想不出来的大事。我原以为grunt connect会完成连接,但似乎server.js在等待什么

NB:我想我不需要快递

以下是不同的文件:

  • Grunfile.js
  • server.js
  • package.js
Grunfile.js

package.json


这是一个巨大而严酷的调试,但我最终发现了

它来自于我犯的多个错误和bug:

  • node server.js是无用的
  • 我研究了grunt connect方法并创建了一个生产设置
  • 我将grunt服务分为grunt构建任务和webconnect任务

  • 然后更新了package.json文件

  • 对于heroku非常重要:在连接对象的Gruntfile.js中:

     dist: {
            options: {
                port:process.env.PORT, #<=== need to have a dynamic port env for Heroku deployment
                open: true,
                base: '<%= appConf.dist %>'
            }
        }
    
    然后在package.json上:

    "scripts": {
      "postinstall": "bower install && grunt build",
      "start": "grunt webconnect"
    }
    

    您是否有指定web进程的Procfile?你把网络动态放大到>0了吗?@M00B我不需要这个配置中的Procfile。也没有关于dyno高档的需求。我在下面的答案中发现了这个错误。很高兴它为您解决了!对不起,我没有更多的帮助
    {
    "private": true,
    "engines": {
      "node": "4.2.2"
    },
     "scripts": {
      "postinstall": "bower install && grunt build",
      "start": "node server.js"
     },
     "dependencies": { all the dependancies .... }
    }
    
     dist: {
            options: {
                port:process.env.PORT, #<=== need to have a dynamic port env for Heroku deployment
                open: true,
                base: '<%= appConf.dist %>'
            }
        }
    
    // Build the production application
    grunt.registerTask('build', 'Compile on dist folder', function () {
    
        grunt.task.run([
            'clean:dist',
            'ngconstant:production',
            'wiredep',
            'sass',
            'concurrent:dist',
            'autoprefixer:dist'
        ]);
    });
    
    // Build the production application
    grunt.registerTask('webconnect', 'connect web server', function () {
    
        grunt.task.run([
            'connect:dist'
        ]);
    });
    
    "scripts": {
      "postinstall": "bower install && grunt build",
      "start": "grunt webconnect"
    }