node.jsnpmnext.jsnext.js13npx

When I try to set up Next.js app it shows me NPM ERR


When trying to set up a new app using npx create-next-app@latest it shows me the error:

npm ERR! code EJSONPARSE
npm ERR! path C:\Users\user\AppData\Local\npm-cache\_npx\cc2145a2fe1558fa/package.json
npm ERR! JSON.parse Unexpected token '', ""... is not valid JSON while parsing ''
npm ERR! JSON.parse Failed to parse JSON data.
npm ERR! JSON.parse Note: package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache\_logs\2024-04-21T17_19_55_143Z-debug-0.log

How can I fix this?

I tried cleaning up of cache in npm module and restarted the whole VS Code setup and after that I deleted and re-installed VS Code to solve the issue it won't work


Solution

  • package.json must be actual JSON, not just JavaScript

    Can you show your package.json file?

    Looks like you just made some simple mistake, try to validate it with: https://jsonlint.com