简体   繁体   中英

“Invalid numeric literal at line” error

The following is my package.json file:

{
  "name": "site",
  "version": "1.0.0",
  "description": "Website",
  "main": "main.js",
  "engines":  {
    "node": "6.11.2"
  },
  "scripts": {
    "start": "node main_cluster.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Subaru",
  "license": "UNLICENSED",
  "dependencies": {
    "body-parser": "^1.18.2",
    "connect-pg-simple": "^4.2.1",
    "cookie-parser": "^1.4.3",
    "csurf": "^1.9.0",
    "express": "^4.15.4",
    "express-handlebars": "^3.0.0",
    "express-logger": "0.0.3",
    "express-session": "^1.15.5",
    "formidable": "^1.1.1",
    "loadtest": "^2.3.0",
    "minimatch": "^3.0.4",
    "morgan": "^1.8.2",
    "pg": "^7.3.0"
  },
  "devDependencies": {
    "chai": "^4.1.2",
    "grunt": "^1.0.1",
    "grunt-cafe-mocha": "^0.1.13",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-exec": "^3.0.0",
    "mocha": "^3.5.3",
    "selenium-webdriver": "^3.5.0"
  }
}

I get the following error, when I try git push heroku master :

parse error: Invalid numeric literal at line 7, column 22

But I can't figure out the error ? What is the problem ? The package.json file was created automatically. The only thing I created by hand was the entry for "engines" which is needed by heroku. What is the mistake ?

EDIT: If i Delete these three lines, the error goes away:

  "engines":  {
    "node": "6.11.2"
  },

Can someone explain what the problem is ?

I am not sure if this works for you, I was facing same error in past days, I make it resolve by cleaning cache,

heroku config:set NODEMODULESCACHE=false
git commit -am 'rebuild' --allow-empty
git push heroku master
heroku config:unset NODEMODULESCACHE

Here is the heroku link of node project for i was facing same issue, https://pdf-annotate.herokuapp.com/

"engines":  {
    "node": "^6.11.2"
  },

write as above, the error will not be there

I hope that this information is helpful for you.

In theory, it is not a JSON error. Because if you put your file in a JSON Validator for example , the website says "Valid JSON".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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