FAQ: Browser Compatibility and Transpilation - npm init

This community-built FAQ covers the “npm init” 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 npm init

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!

Hi to everyone!
I’m on
https://www.codecademy.com/courses/introduction-to-javascript/lessons/browser-compatibility-and-transpilation/exercises/npm-init?action=resume_content_item
I’m using a Firefox browser.
I have “Nodejs” installed on my pc.
I was doing exercise 2 but I didn’t understand the instruction
" Use npm to create a new package.json file. We recommend you set the name and description properties to the following values:

  • namelearning-babel
  • descriptionUse Babel to transpile JavaScript ES6 to ES5

Enter ls into the terminal to see the file structure of your current directory. Notice the addition of package.json .".
Generally I didn’t understand where is the project.Just on codecademy or, also, on my pc?
Thank you
Maria Teresa

1 Like

Hello, Maria

Run npm init in the terminal and continue seting the properties.

question. how do I aces console on my pc? I’m using Vs Code but I can’t find a way to install node js because I don’t know how to find the console thing where you run programs.

Hi @purplebleaf the console is the bash terminal on the right hand side. You should not install node on your computer. rather use the one on codeacademy.

Though if you do want to install node on your computer you can use google for an explanation because this tutorial does not cover that

I believe this exercise is too straight-forward and lowly adaptable. Because many people reading this exercise are probably new to things such as terminals, code files and such, we can all get easily confused. I believe it would be proper for the site staff to adjust this part of the lesson to be calmer and easier to understand by novice people (like me).

4 Likes

I am stuck on this too. Can someone give me a screenshot of how to run this?

1 Like

im lost on this one. this seems way over my head

After entering “ls” to see the file structure in Step 1,
create a package.json file by entering “npm init” (which goes to Step 2).
In name property, enter “learning-babel” and press Enter.
Continue to set other properties or just press Enter to leave the properties blank.

image

Hi, Im very new on coding.
One question, when I write " npm install babel-cli -D" to the console and I run it the program says I should go to step number 2. In order to enter: " npm install babel-preset-env -D" I don’t know exactly how to pass to the next line. If I enter Enter then it starts like runing a program witch I don´t understand. Could you help me with it?
Thanks !!

Hi @board1016062662, that’s okay! That’s exactly what is supposed to be happening. The command npm install babel-cli -D installs a command line package needed to use Babel to transpile your code from ES6 to ES5.

You will need to hit enter, wait until it finishes, and then enter the next command to install another package. Don’t worry it’s not actually affecting your computer in any way. It’s all in-browser. :slight_smile: