简体   繁体   中英

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 '\' at 1:1374 npm ERR! e#readme","_id":"is-finite@1.0.1","_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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM