FAQ: Browser Compatibility and Transpilation - Transpilation With Babel

Thank you runjaj2,

You should replace the guy who wrote this part of lessons :slight_smile:


Ok, so I get that not all browsers are ES6 compatible and that we may have to use Babel to get a ‘translation’ into an older language but how does this work in the real world?
When we eventually create our site, do we upload the converted older syntax alongside the new? Or just the old? How does that work practically?
Thanks in advance

I have been following the entire JavaScript lessons in order up until now.

However in MacOS Catalina in Terminal, typing npm install babel-cli results in

-bash: npm: command not found

There was never any discussion of prerequisites to have installed to do these lessons, or did I miss it?

Is this described somewhere? Why would you know this is supposed to exist and how to get it other than googling randomly?

to those confused (and probably understand what transpilation is) on how to start transpilation, please check out this resource. it has really helped me start from the basics and has intricate details on how to go about using Babel.

1 Like

on how to start transpilation, please check out this resource. it has really helped me start from the basics and has intricate details on how to go about using Babel.

on how to start transpilation, please check out this resource. it has really helped me start from the basics and has intricate details on how to go about using Babel.

thank you! :slight_smile:

No matter how long/hard I try. I can not successfully complete this task.

I even watched the help video and step-by-step ensured I was doing everything correctly.

Why can I not complete this!? :frowning:

1 Like

so I run “npm run build” and I get all these errors…The girl that did the lesson or their environment or something is wrong. I am not getting results here.

$ npm run build

learn-javascript-transpilation-transpilation-project@1.0.0 build /home/ccuser/workspace/learn-javascript-transpilation-transpilation-project
babel src -d lib

You have mistakenly installed the babel package, which is a no-op in Babel 6.
Babel’s CLI commands have been moved from the babel package to the babel-cli package.

npm uninstall -g babel
npm install --save-dev babel-cli

See http://babeljs.io/docs/usage/cli/ for setup instructions.

npm ERR! Linux 4.14.181-142.260.amzn2.x86_64
npm ERR! argv “/usr/bin/nodejs” “/usr/bin/npm” “run” “build”
npm ERR! node v7.10.1
npm ERR! npm v4.2.0
npm ERR! errno 1
npm ERR! learn-javascript-transpilation-transpilation-project@1.0.0 build: babel src -d lib
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the learn-javascript-transpilation-transpilation-project@1.0.0 build script ‘babel src -d lib’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the learn-javascript-transpilation-transpilation-project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel src -d lib
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs learn-javascript-transpilation-transpilation-project
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls learn-javascript-transpilation-transpilation-project
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/ccuser/.npm/_logs/2020-10-02T00_44_49_843Z-debug.log

When I run the main.js I get an error in command line 9 BEFORE even starting doing the steps of the project, I have no idea what´s wrong since syntax looks correct (or maybe i am missing it). It says issue is in the get name() part…
Can you help?

class HospitalEmployee {
  constructor(name) {
    this._name = name;
    this._remainingVacationDays = 20;
  get name() {
    return this._name;
  get remainingVacationDays() {
    return this._remainingVacationDays;
  takeVacationDays(daysOff) {
    this._remainingVacationDays -= daysOff;
  static generatePassword() {
    return Math.floor(Math.random()*10000);

class Nurse extends HospitalEmployee {
  constructor(name, certifications) {
    this._certifications = certifications;
  get certifications() {
    return this._certifications;
  addCertification(newCertification) {

const nurseOlynyk = new Nurse('Olynyk', ['Trauma','Pediatrics']);
let nurseDurant = new Nurse('Durant', ['Orthopedics']);

module.exports = HospitalEmployee;

Thank you! This is exactly what I needed.

So I can “pass” this lesson by typing in all the commands, but all I get back is a giant list of errors. There’s no lib folder, and refreshing as suggested just clears the lesson. I know what command prompt is, but I’ve never really used it - was this a prerequisite for javascript that I missed somehow? I appreciate all the links to tutorialspoint.com/babeljs/ but I feel like I’ve suddenly been thrown in the deep end. What exactly was supposed to happen? Is this actually generating new files?

1 Like

Sometimes I don’t understand CodeCademy. Were we just supposed to know this? Like what??

I don’t have a clue what I’m supposed to do with these exercises. They don’t mention what to type and the hints and solutions only show what’s in the JavaScript editor, not where we’re typing. Could someone please help? Thanks in advance.

Here’s a video I found that made the lesson quick and easy:


Thank you for this. This really helped :grinning:

1 Like

You may want to type cat ./lib/main.js

It will display on the terminal the content of the file

Hint: In Unix talk, cat copies a file in the teminal, https://www.tecmint.com/13-basic-cat-command-examples-in-linux/

Hi how about a simple message along the lines of ‘click on the folder icon next to main.js to verify that the .lib directory has been created’?

Thank you so much! I didn’t know where to find the ./lib/main.js and your instructions helped. I didn’t even notice the folder icon before.

1 Like

spell check. I kept having this issue because i would use “npm install babel-present-env” instead of the correct syntax “npm install babel-preset-env”