3

I have an issue while deploy my nodejs Apps to Heroku. I tried to git push directly (heroku cli) and also tried from github deploy, but both of them failed. Here log i got:

-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
jq: error (at <stdin>:19): Cannot index string with string "iojs"
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

I tried to check maybe dev dependents was the culprit, then try to change dev dependents package and remove all node_modules filder which "may" cause failure, but after retry, I'm still faced this issue. Also I tried to change the engine from 17.x to 16.x but still persists.

Maybe someone can give me a clue?

Below package.json i have:

{
  "name": "coupling",
  "version": "1.0.0",
  "engines": "17.x",
  "description": "",
  "main": "server.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@vercel/node": "^1.12.1",
    "csv-parser": "^3.0.0",
    "express": "4.17.2",
    "ws": "^8.4.2"
  }
}

0

1 Answer 1

2

Your engines section is invalid:

  "engines": "17.x",

Its value should be an object, not a string. Try this instead:

  "engines": {
    "node": "17.x"
  }
Sign up to request clarification or add additional context in comments.

3 Comments

I've editted but problem still persist. Checked on csv-parser there is text required iojs. So i use another module and use template from nodejs-getting-started and i successful deploy.
@fadlim, well the exact contents depend on your specific needs. I don't know anything about your application so you may have to. The point is that engines needs to be an object. That resolves the issue you were facing above. If you want to use io.js you can, but that has nothing to do with the question you asked. (iojs is mentioned in the error, but that is just because it happens to be the first engine string that gets tried. The issue is that jq cannot process "17.x" as a JSON string.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.