简体   繁体   中英

How to install Babel using Package Control on Sublime Text 3?

I want to install Babel . I'm using a Mac, I already have Sublime Text 3 and Package Controll newly installed. So I tried cmd + shift + p to open up Package Controll and I typed " Install " but nothing shows up. I was following this link . I need Babel for React syntax highlighting.

You might what to check the file path of where Sublime 3 was placed. Did you sudo install? Perhaps this link will help.

http://www.sublimetext.com/forum/viewtopic.php?f=3&t=12909

Had the same issue, in my case I had to install package control first, I used "simple installation" method by pasting the code from Package.io into the console (View > Show Console).

For Sublime 3:

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( ' http://packagecontrol.io/ ' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

and for Sublime 2:

import urllib2,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( ' http://packagecontrol.io/ ' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

You can install the Babel Package by following the below steps.

 1.open the url 
   -> https://packagecontrol.io/installation
 then copy the code in that page like this

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( ' http://packagecontrol.io/ ' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

Note: The above code will be updated frequently

 2.Open Sublime text editor and "Goto View option and select Show Console"
 3.Paste the above code the console and press enter
 4.press command+shift+p to bring up the Command Palette
 5.In that search box type the text as "Package Control" and select the "Package Control:Install Package" option
 -> A new search box with options will come.
 6.Type the text “Babel” and select the Babel in the list. It will install the babel package.
 7.To Activate the Babel Syntax for the js file 
-> View -> Syntax -> Babel

Note: To open all of the folder files with the babel syntax

-> Goto View -> Syntax -> Open all with current extention as JavaScript -> Babel

Manually : For Babel-sublime

If for some reason the console installation instructions do not work for you (such as having a proxy on your network), perform the following steps to manually install Package Control:

1)Preferences > Browse Packages

Browse up a folder and then into the folder Download Package Control.sublime-package and copy it into the Installed Packages/ directory.

For Sublime 2

import urllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

For Sublime 3

import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' + 'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

And Restart Sublime Text

Want More inforfation click here

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