package.json must be actual JSON, not just JavaScript.
Unanswered
Yakutian Laika posted this in #help-forum
Yakutian LaikaOP
Hi, so i just sterted the react and next.js course. And i have a problem with installing Next.js. I am asked to create a new file, package.json with an empty object {} , and put this into terminal : npm install react@latest react-dom@latest next@latest. However when i put that it returns an error :
npm error JSON.parse Unexpected end of JSON input while parsing empty string
npm error JSON.parse Failed to parse JSON data.
npm error JSON.parse Note: package.json must be actual JSON, not just JavaScript.
I have installed node.js and im using visual studio code. Could someone help me with resolving this issue? thx
npm error JSON.parse Unexpected end of JSON input while parsing empty string
npm error JSON.parse Failed to parse JSON data.
npm error JSON.parse Note: package.json must be actual JSON, not just JavaScript.
I have installed node.js and im using visual studio code. Could someone help me with resolving this issue? thx
5 Replies
can you send a picture of your package.json
Yakutian LaikaOP
make sure to save your file, currently it has the dot which indicates it hasnt yet
I can't replicate your error, I tried with empty object, with no object, extra spaces, etc
I suggest npm cache clean -force
I suggest npm cache clean -force
also cant you just delete package.json and then init to get it (bonus points if npx create-next-app)