Diablo3093
Diablo3093

Reputation: 1053

Error while trying to install Babel JSX precompiler

Hi am getting the following error while trying to precompile my JSX code. I have been using it but something happened and I am unable to install this

npm install babel-preset-es2015 babel-preset-react

It is showing this error message:

npm ERR! Linux 3.13.0-85-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "babel-preset-es2015" "babel-preset-react" npm ERR! node v4.4.5 npm ERR! npm v2.15.5 npm ERR! file /home/name/.npm/babel-plugin-check-es2015-constants/6.8.0/package/package.json npm ERR! code EJSONPARSE

npm ERR! Failed to parse json npm ERR! Unexpected token '\u0000' at 1:1374 npm ERR! e#readme","_id":"[email protected]","_from":"is-finite@>=1.0.0 <2.0.0"} npm ERR!
^ npm ERR! File: /home/name/.npm/babel-plugin-check-es2015-constants/6.8.0/package/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! /var/www/html/js/npm-debug.log

How to fix this?

Upvotes: 0

Views: 128

Answers (1)

Damien Leroux
Damien Leroux

Reputation: 11693

If you want to install globally on your computer those modules, add -g:

npm install -g babel-preset-es2015 babel-preset-react

Otherwise, it meand you want to install it locally. Make sure your have package.json in the root used to launch that command. Follow package rules. Here is an example. Your can try to validate your package.json on package-json-validator.com

Upvotes: 1

Related Questions