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

2 Likes

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).

10 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

2 Likes

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:

2 Likes

Thank you !!!

I have an issue that nobody has touched on yet…

In step 2 it says: We recommend you set the name and description properties to the following values:

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

thing is … the name property already has been set with: “learn-javascript-transpilation-bct-npm-init”, and you cannot delete or change that …well … i have tried only once, i will try again after i submit this post ???

If you see this:

name: (learn-javascript-transpilation-bct-npm-init) 

this means that learn-javascript-transpilation-bct-npm-init is a default value of name. This value will be used if you simply hit enter, but you should be able to type in different name.


If this does not work you can always change the name later by opening package.json file and changing the value assigned to name.

1 Like

you cant. Ahh ok thanks my dude :relieved: but the thing is Codecademy TELLS you to change the name in step 2, so you’re going to have millions of learners (emphasis on the word LEARNERS) spending like an hour at a time trying to figure out …how to change it! However, the exercise does pass you so … scratches head

I understand this (no need to use caps), but I am not able to reproduce this problem and this is the first time that I see a report of such problem. If this will repeat - I will investigate this problem and I will report this bug.

This is how it looks for me -> https://drive.google.com/file/d/1dgw72yrnK8ABFbwNQ6V_QJK_ly1UGXv5/view.

1 Like

Ok thank you so much @factoradic apologies for the caps, just wanted to add emphasis to my wording, thanks again bro.

1 Like

You’re very welcome :slight_smile: Nothing bad happened, no need to apologize, I understand now :slight_smile:

What do I enter to complete TASK - Run ls in the terminal to see the file structure of your current directory.

You have to literally type ls in the terminal.

Is there any problem with the terminal itself?