0

I'm following the steps from here https://babeljs.io/setup#installation.

I create a package.json file and then run

npm install --save-dev babel-cli

I get the error:

npm ERR! Darwin 17.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-- 
save-dev" "babel-cli"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! file /Users/name/Desktop/Graphs/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! No data, empty input at 1:1
npm ERR! 
npm ERR! ^
npm ERR! File: /Users/name/Desktop/Graphs/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. 
JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/name/Desktop/Graphs/npm-debug.log

I've tried

npm cache clear

and

npm update

But it still doesn't work. Any ideas?

  • Post your package.json, the error says your package.json cannot be parsed – kit Sep 06 '18 at 16:07
  • It seams that something is wrong with your package.json – Lazar Nikolic Sep 06 '18 at 16:09
  • It's blank. I'm a newbie and thought that it would be populated when I installed babel-cli... Is there a specific template I should use to create some info about the project? –  Sep 06 '18 at 16:10
  • Sorry, I added {} in my package.json and it worked. –  Sep 06 '18 at 16:17

1 Answers1

0

Something is wrong in your package.json. Rather than start with a blank file, you should run

npm init

to generate a template for a package.json file.

If you don't want to answer all of the questions to customize the template, run

npm init -y

to generate a blank, default template.

dpopp07
  • 561
  • 5
  • 10