FAQ: Browser Compatibility and Transpilation - Babel Source Lib

This community-built FAQ covers the “Babel Source Lib” exercise from the lesson “Browser Compatibility and Transpilation”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Introduction To JavaScript

FAQs on the exercise Babel Source Lib

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I get the following error message when I start the lesson on “Babel Source Lib”

What did I do wrong? How do I move the .json file back to where it should be?

1 Like

I got this too - I don’t know why, but I think it is because the nam init command wasn’t fully executed - i.e cancelled before package.json was created. To solve it and get past the exercise I created a package.json file and pasted

 "scripts": {
  "test": "echo \"Error: no test specified\" && exit 1",
  "build": "babel src -d lib"
}

into it.

Hope this helps :slight_smile:

1 Like

Hi, in the sections i don’t understand how to write into package.json or how to open it. i know how to use vim and i did but that’s not the solution i clicked get solution, but it only solved the problem but didn’t show me how and what it did. the same thing occured with the .babelrc section

4 Likes

Click on the folder icon near the “main.js” title of the middle section. There you’ll see the tree of folders and files. Then just click on the “package.json” file and when it will be opened type the text in.

2 Likes

When I tried to run the “npm run build” in my own project, I got an error message saying: “missing: build script”. I have checked the code, I followed all the instructions given in the lesson, but I still have the issue. Any ideas?

I noticed that my previous response had an error on the screenshot, so this is a new reply. Please see the attached screenshots.
Under the file directory, the folder icon, you’ll want to navigate to “package.json” type in the build command within the code editor. Then you’ll type the “npm run build” command on the transpiller and hit run.

I do not have the package.json, why? how do I go about this task?

3 Likes

Babel Source Lib
the “RUN” button is stuck, it just keeps circling.
How do I get out of this?