Transpilation Project

I managed to complete the Transpilation project without any problems - converting ES6 Javascript syntax to ES5 Javascript using Babel node using the bash terminal.

However, I wanted to try this on my own computer using windows 10. Based on previous exercises I downloaded the Babel node to my computer, as well as the Bash terminal. Using the exact same project files in the codecademy project, copied and pasted to my computer directory I tried to convert the main.js in the same way, however all that occurs is that the main.js is copied exactly the same into a new lib folder.

In other words the syntax is not converted from ES6 to ES5, it just stays the same despite the json.package appearing to install correctly. I assume that the reason might be that I downloaded Babel incorrectly.

Anyone else have this problem or able to point me in the right direction?

1 Like

Without a way to reproduce exactly the same thing as you did, nobody knows what you did or didn’t do.
For starters it’s unclear whether you’re asking about windows or babel or node or bash or your own code or project configuration. Pick one. Isolate the problem.

1 Like

Hi :slight_smile: I get this error: Failed at the babel-project@1 build script ‘babel src -d lib’. when I run npm run build. Can anyone help me?

$ npm run build
npm ERR! Linux 4.14.198-152.320.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! file /home/ccuser/workspace/learn-javascript-transpilation-transpilation-project/package.json

npm ERR! Failed to parse json
npm ERR! Unexpected token ‘a’ at 10:4
npm ERR! “author”: “”,
npm ERR! ^
npm ERR! File: /home/ccuser/workspace/learn-javascript-transpilation-transpilation-project/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR! /home/ccuser/.npm/_logs/2021-02-16T20_44_40_633Z-debug.log

Anyone else had this error ? I’m not sure if at step 5 I’m supposed to see the lib folder created or not, but I can’t see it… :grimacing: :relieved:

Hi there

I did wonder whether it was an issue with your setup and in particular your configuration before reading the error log from the terminal posted above.

I can’t guarantee you an answer but I’ve done a bit with Babel and React so I’ll take a look if you can share the following:

  • package.json

  • webpack.config.js

  • .babelrc

Also I’ve only setup things like this on a Mac so far but I can give it a try on my Windows machine to see what the differences are if any. I obviously know that you may not be using webpack and therefore may not have the webpack.config.js so just send what you do have either by posting it here as code or by attaching the files to a post in this thread.