Reputation: 11
I am trying to start NPM after installing it but the start errors out.
I couldn't find syntactical errors in the 'package.json' file I couldn't find the error log I tried reinstalling I tried clearing my cache All without success
Here is my 'package.json' file:
{
"name": "git-test",
"version": "1.0.0",
"description": "test json file",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"lite-server": "^2.4.0"
},
"scripts": {
"start": "npm run lite"
"test": "echo \"Error: no test specified\" && exit 1"
"dev": "lite-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools.git"
},
"author": "Master-Hippo",
"license": "ISC",
"bugs": {
"url": "https://github.com/Master-Hippo/Front-
End_Web_UI_Frameworks_and_Tools/issues"
},
"homepage": "https://github.com/Master-Hippo/Front-
End_Web_UI_Frameworks_and_Tools#readme"
Here is the error log:
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 228 while parsing
'{
npm ERR! JSON.parse "name": "git-test",
npm ERR! JSON.parse "version": "1.'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
And, although the message says an error log was created in a specific folder, none actually exists in said folder.
How can I resolve this issue?
Upvotes: 1
Views: 8221
Reputation: 1
Also note sometimes this issue can occur even if there is no missing comma in package.json file. This occurs due to node version.
In my case, I hade node version 14.17.1 installed on my system and the repo was working in 16.xx.xx version and I faced this issue, and once i upgraded node the problem got resolved.
So also keep this point in mind.
Upvotes: 0
Reputation: 730
Try validate your package.json
with jsonlint
I guess that your file could be like this:
{
"name": "git-test",
"version": "1.0.0",
"description": "test json file",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"lite-server": "^2.4.0"
},
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "lite-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools.git"
},
"author": "Master-Hippo",
"license": "ISC",
"bugs": {
"url ": "https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools/issues"
},
"homepage": "https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools#readme"
}
Upvotes: 3
Reputation: 560
Your package.json should be valid json like this:
{
"name": "git-test",
"version": "1.0.0",
"description": "test json file",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"lite-server": "^2.4.0"
},
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "lite-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools.git"
},
"author": "Master-Hippo",
"license": "ISC",
"bugs": {
"url": "https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools/issues"
},
"homepage": "https://github.com/Master-Hippo/Front-End_Web_UI_Frameworks_and_Tools#readme"
}
There were a few commas missing.
Upvotes: -1