BROWSER COMPATIBILITY AND TRANSPILATION /7. Install Node Packages


#1

Hi all !
I can’t install Babel -cli -D . I have an entire page ERROR message


Do you have to install npm or Babel on your own computer ? I ve already installed Git on my Command Line . Can you install Babel or npm on my own computer’s command line ?
https://www.codecademy.com/courses/learn-javascript-transpilation/lessons/browser-compatibility-and-transpilation/exercises/npm-install?action=lesson_resume&course_redirect=introduction-to-javascript

thanks !


#2

did you read the error message? the lines in the middle are really interesting, package.json has to contain json, it seems you added plain javascript to package.json, this can’t be. At least, that is what the error message says

it can be very handy to do so, yes. Then you can write es6 on your own computer, and trans-pile it to es5 for your website (assuming you want to build a website)

not on CMD (windows command line) or powershell, but GIT also included BASH, you can install npm and babel in BASH. its important to understand what the different layers are


#3

_Oh yes ! How do you have to write in package.json ? with JS ? I thought it was bash ? I don’t know bash .


#4

JavaScript Object Notation (JSON) needs to be written in the package.json, you can just open it using the file explorer provided by the lesson, and then edit the file using the text-editor. As for what you need to write in it, you would have revisit an earlier lesson.

can i see the content of your package.json file? Did you read the error message? And found the lines which indicate a problem with package.json?

installing packages using npm with -D (save dependencies) needs package.json, so there can’t be mistakes in that file.

so you are using bash in this lesson (the right most window where you type the commands), but you have no idea what it is, sound risky/tricky.


#5

Here is the content of package.json file (sorry for late reply!) :

let name = learning-babel
let description = Use Babel to transpile JavaScript ES6 to ES5

// I wrote it in JS .


#6

its a .json file, not a .js file, you need to write JSON syntax in it. You can’t just write JS in it.

that like trying to speak to a French (JS) to a Spanish person (package.json). They won’t understand each other. Which is why you get an error, I already told you what you should do:

i feel like you are only responding to 25%-50% of what i am saying.


#7

I ve created manually a package.json file where I put the code in it . And this code , I wrote it in JavaScript .
thanks for your help Stetim94 !
I listen to you 100% !


#8


#9

Creating a package file manually is fine, but you still have to write JSON syntax in it.

I have no indication i understand you what and how you need to fix it. And look into BASH, given you are so heavily relying on it, without understanding it (which is always a bad things, you don’t have to be a master in it, but a little understanding goes a long way)


#10

Do you suggest I stop this lesson and come back to it later ? Is bash taught in Codecademy , is it ?


#11

yes, its taught here:

https://www.codecademy.com/learn/learn-the-command-line

i don’t you have to take the entire course if its not the direction you want to go in, but you should at least google what Bash, npm and json are. Understanding what you are working with really makes life easier.

You can fix your package.json file, then you should be able to just continue.


#12

thanks Stetim for your help ! The Javascript course can continued without knowing this part however ?


#13

You would have to complete the exercises to continue.

in the previous exercise:

https://www.codecademy.com/courses/learn-javascript-transpilation/lessons/browser-compatibility-and-transpilation/exercises/npm-init?action=lesson_resume&course_redirect=introduction-to-javascript

you ran npm init which created a package.json, why did you change it? The package.json file should have been ported to the next lesson (the one you are currently add)

Otherwise, remove package.json and run npm init again in the current lesson. This creates package.json which contains information on your javascript project. Then we can add an save the dependencies we need to install in this lesson.

I don’t think you should skip through this, as a javascript developer you need to know what es6 and es5 are, and why we need to transpile, and how we can do this (with tools like babel en webpack)


#14

_ because it didn’t install through the Terminal . So I created it manually .


#15

ok I m going to reinitialize with npm init
thanks !


#16

And like i said, you can write JS code in package.json. What is it you still need my help with? I feel like we are running in circles

Why would you not install through the command line? An excellent tool (npm) is offered to you, to structure your project, use it to your advantage.


#17

yes downloading npm is a good idea! I should have start with this !


#18

do you even know what NPM is?


#19

yes it was explained in previous exercices , wasn’t it ?
https://docs.npmjs.com/getting-started/what-is-npm
npm


#20

I was wondereing if the Node Package Manager has something to do with the famous Node.js .