I was trying to run npm lite server ,but it is showing me "Failed to parse json data ,
I initiated the process with npm init
command then I gave the command npm install lite-server --save-dev
and it created the node module .after that I updated the script section as :
"scripts": {
"start":"npm run lite"
"test": "echo \"Error: no test specified\" && exit 1"
"lite":"lite-server"
},
After that I gave the command npm start
but then it creates an error Failed to parse json data which I do not know how to resolve .
Following is the error log :
0 verbose cli [
0 verbose cli '/home/admin/.nvm/versions/node/v16.14.0/bin/node',
0 verbose cli '/home/admin/.nvm/versions/node/v16.14.0/bin/npm',
0 verbose cli 'start'
0 verbose cli ]
1 info using npm@8.3.1
2 info using node@v16.14.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/home/admin/.nvm/versions/node/v16.14.0/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/home/admin/Desktop/test_git/.npmrc Completed in 7ms
10 timing config:load:project Completed in 10ms
11 timing config:load:file:/home/admin/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/home/admin/.nvm/versions/node/v16.14.0/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 19ms
19 timing npm:load:configload Completed in 21ms
20 timing npm:load:setTitle Completed in 0ms
21 timing config:load:flatten Completed in 3ms
22 timing npm:load:display Completed in 5ms
23 verbose logfile /home/admin/.npm/_logs/2022-06-18T13_06_09_781Z-debug-0.log
24 timing npm:load:logFile Completed in 6ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 32ms
28 silly logfile start cleaning logs, removing 1 files
29 timing command:run-script Completed in 6ms
30 timing command:start Completed in 8ms
31 verbose stack JSONParseError: Unexpected string in JSON at position 4006 while parsing '{
31 verbose stack "name": "test_git",
31 verbose stack "version": "1.'
31 verbose stack at /home/admin/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/read-package-json-fast/index.js:11:61
31 verbose stack at async RunScript.run (/home/admin/.nvm/versions/node/v16.14.0/lib/node_modules/npm/lib/commands/run-script.js:75:19)
31 verbose stack at async module.exports (/home/admin/.nvm/versions/node/v16.14.0/lib/node_modules/npm/lib/cli.js:66:5)
32 verbose cwd /home/admin/Desktop/test_git
33 verbose Linux 4.15.0-187-generic
34 verbose argv "/home/admin/.nvm/versions/node/v16.14.0/bin/node" "/home/admin/.nvm/versions/node/v16.14.0/bin/npm" "start"
35 verbose node v16.14.0
36 verbose npm v8.3.1
37 error code EJSONPARSE
38 error path /home/admin/Desktop/test_git/package.json
39 error JSON.parse Unexpected string in JSON at position 4006 while parsing '{
39 error JSON.parse "name": "test_git",
39 error JSON.parse "version": "1.'
40 error JSON.parse Failed to parse JSON data.
40 error JSON.parse Note: package.json must be actual JSON, not just JavaScript.
41 verbose exit 1
42 timing npm Completed in 205ms
43 verbose code 1
44 error A complete log of this run can be found in:
44 error /home/admin/.npm/_logs/2022-06-18T13_06_09_781Z-debug-0.log
So can someone please suggest how to resolve this issue ,thank you!