Unexpected End of JSON Input in package.json

I am trying to use flask to create a web app in Python, so I created the file package.json and imported flask, but I keep getting this error in the logs:

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /opt/watcher/source/app-picker.ts:107:39
    at ChildProcess.exithandler (child_process.js:285:7)
    at ChildProcess.emit (events.js:189:13)
    at ChildProcess.EventEmitter.emit (domain.js:441:20)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)

My package.json file looks like this:

{
  "dependencies": {
    "flask": "^0.2.10"
  }
}

and my requirements.txt file looks like this:

flask

Does anyone know what I might be doing wrong? There are no other .json files in the project.

Can you change this to this:

{
  "dependencies": {
    "flask": "^0.2.10"
  },
}
1 Like

I did that, and now I get this:
GlitchError

Parse error on line 4:
...sk": "^0.2.10"  },}
---------------------^
Expected 'STRING', got '}'

Fixed it! Changed file to:

{
  "scripts": {
    "start": "pip3 install -U -r .requirements.txt -t .data/site-packages && env PYTHONPATH=$PWD/.data/site-packages python3 server.py"
  },
  "dependencies": {
    "flask": "^0.2.10"
  }
}
1 Like