简体   繁体   English

“行中的数字文字无效”错误

[英]“Invalid numeric literal at line” error

The following is my package.json file:以下是我的 package.json 文件:

{
  "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 :当我尝试git push heroku master时,出现以下错误:

parse error: Invalid numeric literal at line 7, column 22解析错误:第 7 行第 22 列的数字文字无效

But I can't figure out the error ?但我无法弄清楚错误? What is the problem ?有什么问题? The package.json file was created automatically. package.json 文件是自动创建的。 The only thing I created by hand was the entry for "engines" which is needed by heroku.我手工创建的唯一内容是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/这是我面临同样问题的节点项目的 heroku 链接, 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.理论上,这不是 JSON 错误。 Because if you put your file in a JSON Validator for example , the website says "Valid JSON".因为如果你把你的文件放在一个 JSON 验证器中,例如,网站会显示“有效的 JSON”。

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

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