Heroku Push被拒绝:如果Grunt是其中之一,则构建依赖项时失败 - "(节点)警告:递归process.nextTick检测到..."

时间:2018-03-02 15:15:47

标签: node.js git heroku gruntjs

我很困惑,因为我在开始拒绝任何git push尝试之前,今天两次没有问题地赶到Heroku。 (我在下面的日志中添加了评论。)

//Everything is smooth and then...
remote: -----> Building dependencies
remote:        Installing node modules (package.json + package-lock)
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. 
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.     
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.     
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
//hundreds of that line above again and again...
// Then this line below ONCE
remote:        npm(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. 
//Then hundreds of that other line again...
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.     
remote:        (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
//And eventually...
remote:        
remote:        util.js:35
remote:        var str = String(f).replace(formatRegExp, function(x) {
remote:        ^
remote:        RangeError: Maximum call stack size exceeded
remote: 
remote: -----> Build failed
remote:        
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:        
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:        
remote:        Love,
remote:        Heroku
remote:        
remote:  !     Push rejected, failed to compile Node.js app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to nameOfProject.
remote: 
To https://git.heroku.com/nameOfProject.git
 ! [remote rejected]     master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/nameOfProject.git'

在本地,我可以npm rebuild没有问题,也可以运行应用程序。

我的util.js文件都没有var str = String(f).replace(formatRegExp, funct...,实际上我找不到那行代码。

从我在其他问题中看到的内容," (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral."可能与Grunt有关,但是我没有触及我的Gruntfile.js几天,如果不是几个星期所以我怀疑这将是问题。

修改 事实证明,Grunt IS导致了这个问题。如果我们从package.json文件中取出每个与Grunt相关的依赖项,我们就可以推送到Heroku。 所以我的猜测是Grunt更新了一些东西,那个东西是我们无法控制的,它在某种程度上与Heroku无法合作。

目前,我们的解决方案是不要将Grunt推向heroku,因为我们无论如何都不需要它。但了解发生的事情会很棒。如果您遇到相同问题或有更好的理解,请分享!

这是我们的package.json:

{
  "name": "ourName",
  "version": "0.0.1",
  "dependencies": {
    "@google/maps": "^0.3.1",
    "angular-i18n": "1.6.6",
    "angular-touch": "1.6.6",
    "async": "0.2.8",
    "bluebird": "^3.5.1",
    "bwip": "~0.6.3",
    "cloudinary": "1.0.1",
    "connect-flash": "0.1.0",
    "connect-mongodb": "1.1.4",
    "cookie": "^0.3.1",
    "cron": "1.0.1",
    "ejs": "0.8.4",
    "express": "3.2.5",
    "express-subdomain": "1.0.5",
    "feed-read": "0.0.1",
    "file-system": "^2.2.2",
    "google-auth-library": "^0.10.0",
    "googleapis": "^17.1.0",
    "http-auth": "1.2.2",
    "ipware": "^1.0.0",
    "jade": "~0.27.4",
    "js2xml": "0.0.6",
    "jsonify": "0.0.0",
    "lame": "1.2.1",
    "mailchecker": "3.0.27",
    "mailchimp": "*",
    "mailchimp-api-v3": "1.7.0",
    "moment": "2.1.0",
    "mongodb": "1.3.10",
    "mongoose": "3.6.13",
    "netmask": "^1.0.6",
    "newrelic": "~1.3.1",
    "node-schedule": "1.2.3",
    "nodemailer": "2.4.2",
    "nodetime": ">=0.8.4",
    "object-assign": "^4.1.1",
    "octobat-npm": "^2.0.1",
    "optimist": "0.3.4",
    "password-generator": "2.1.0",
    "pdfkit": "~0.2.7",
    "request": "2.81.0",
    "rollbar": "2.0.0",
    "stripe": "4.24.0",
    "temp": "~0.6.0",
    "time": "0.8.0",
    "timekit": "*",
    "touch": "^3.1.0",
    "twilio": "^2.11.1",
    "uglify-js": "1.3.3",
    "underscore": "^1.8.3",
    "v8tools": "*",
    "wav": "0.1.2",
    "when": "1.7.1",
    "xml2js": "0.4.17"
  },
  "devDependencies": {
    "angular-momentjs": "^0.2.2",
    "autoprefixer": "^7.1.2",
    "chai": "*",
    "cssnano": "^3.10.0",
    "database-cleaner": "0.7.0",
    "expect.js": "*",
    "factory-lady": "0.1.0",
    "grunt": ">=0.4.1",                 //REMOVED AND THEN IT WORKS
    "grunt-contrib-concat": "^1.0.1",   //REMOVED AND THEN IT WORKS
    "grunt-contrib-imagemin": "^1.0.1", //REMOVED AND THEN IT WORKS
    "grunt-contrib-jshint": "^1.1.0",   //REMOVED AND THEN IT WORKS
    "grunt-contrib-uglify": "^3.0.1",   //REMOVED AND THEN IT WORKS
    "grunt-hash": "^0.5.0",             //REMOVED AND THEN IT WORKS
    "grunt-postcss": "^0.8.0",          //REMOVED AND THEN IT WORKS
    "lodash": "1.2.x",
    "mocha": "1.10.0",
    "moment": "^2.1.0",
    "pixrem": "^3.0.2",
    "vows": ">=0.6.4",
    "zombie": "2.0.x"
  },
  "engines": {
    "node": "0.10.x",
    "npm": "3.9.2"
  },
  "scripts": {
    "test": "NODE_ENV=test vows test/api/*.js test/web/*.js --spec",
    "start": ""
  }
}

1 个答案:

答案 0 :(得分:0)

我发现您的问题可能来自我在package.json

结尾处评论的这一行
  "engines": {
    "node": "0.10.x", //here
    "npm": "3.9.2"
  },
  "scripts": {
    "test": "NODE_ENV=test vows test/api/*.js test/web/*.js --spec",
    "start": "" //here
  }
}

engines您的node版本上可能会导致该错误,因此我建议您将engines更改为以下内容:

"engines": {
  "node": "*", //this should make your app run on the most recent version of node
  "npm": "*" //this should make your app run on the most recent version of npm

然后是您的scripts,您仍然没有从start指定您的入口点。您的scripts应该是这样的:

  "scripts": {
    "test": "NODE_ENV=test vows test/api/*.js test/web/*.js --spec",
    "start": "node index.js" //this is where you should place your entry point.
  }

注意:使用index.js并不是最常见的,您可以使用您调用的名称编写应用入口点,可能是app.js或{{ 1}}或者你叫它的任何东西。

我还注意到你的server.js中没有"main": ""

package.json实施这些更正,您的问题应该得到解决