Reputation: 93
i'm trying to upload a javascript nodejs project to Heroku. Localhost works perfectly but when i try to upload it gives me a unable to parse error at :
...
"engines" : { "node" : ">0.11.9" },
...
The Error Message : Invalid numeric literal at line 12, column 0
Full JSON File:
{
"name": "browsergameprojecz",
"version": "1.0.0",
"description": "",
"main": "app.js",
"dependencies": {
"express": "^4.16.3",
"mongojs": "^2.6.0",
"socket.io": "^2.1.1"
},
"engines" : { "node" : ">0.11.9" },
"devDependencies": {},
"scripts": {
"start": "node app.js"
},
"author": "",
"license": "ISC"
}
Upvotes: 0
Views: 1906
Reputation: 76689
there are Linters for that, eg. the Package JSON Validator
... which lets one inspect the validity of such JSON files.
besides Node 0.11.9 is roughly 5 years old and tagged as unstable
... consider upgrading, while this is possible in combination with the rest.
there might be Windows line-ending in that file ...as it often is the case, when "everything looks fine", but still not works are excepted. dos2unix can be used to fix them.
https://techblog.dorogin.com/writing-cross-platform-npm-scripts-on-windows-79c510339ea6 hints for, that when files have a UTF-8 BOM
0x EF BB BF
at the beginning, this also makes it un-parse-able. unless checking this with a hex-editor, one can not know. simply creating a new package.json
with UTF-8
endoding and UNIX \n
line-endings should resolve the issue.
Upvotes: 1
Reputation: 1
When the data is upload to the client from the server side in JSON format, some special characters can not be displayed directly when the JS is displayed on the HTML page. As the background is passed through the <b>msg</b>
, it is displayed in the HTML page msg
by JS, and it is not msg
. This is due to the content between <
and >
as HTML. Tagging, and start with HTML as entity, so the display is not normal.
The solution is simple, and can be rendered before JS is rendered to HTML pages.
Upvotes: 0
Reputation: 335
This is from the official npm docs. It looks like you need a range for a version not just a lower limit. Or an approximate version. However from my experience with Heroku I have never needed this it seems heroku will probably use a node version much higher. Also if you need a specific version there is such a thing called engineStrict
which you can have a look at in the official npm docs.
Upvotes: 0