Help with Transpilation project

I could use some help with this project :https://www.codecademy.com/paths/build-web-apps-with-react/tracks/bwa-modern-javascript-modules-and-browser-compatibility/modules/learn-javascript-transpilation/projects/transpilation

I have followed the steps and at step 5 I get the following errors with no clue how to solve them.

$ ls
src
$ npm init -y
Wrote to /home/ccuser/workspace/learn-javascript-transpilation-transpilation-project-update/package.json:

{
“name”: “learn-javascript-transpilation-transpilation-project-update”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”
},
“keywords”: ,
“author”: “”,
“license”: “ISC”
}

$ ls
package.json src
$ ls
package.json src
$ ls
package.json src
$ npm run build
npm WARN lifecycle The node binary used for scripts is /home/ccuser/.bin/node but npm is using /usr/bin/node itself. Use the --scripts-prepend-node-path option to include the path for the node binary npm was executed with.

[email protected]0 build /home/ccuser/workspace/learn-javascript-transpilation-transpilation-project-update
babel src -d

TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string or an instance of Buffer or URL. Received type boolean (true)
at mkdirSync (fs.js:1005:10)
at /home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:197:183
at Generator.next ()
at asyncGeneratorStep (/home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:40:103)
at _next (/home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:42:194)
at /home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:42:364
at new Promise ()
at /home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:42:97
at _ref (/home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:249:15)
at _default (/home/ccuser/node_modules/@babel/cli/lib/babel/dir.js:60:15) {
code: ‘ERR_INVALID_ARG_TYPE’
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected]0 build: babel src -d
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected]0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ccuser/.npm/_logs/2023-03-01T14_50_56_434Z-debug.log
$

Here is my code:
.babelrc file

{
  "preset" : "@babel/preset-env"
}

package.json

{
  "name": "learn-javascript-transpilation-transpilation-project-update",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "babel src -d"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

If anyone can help or point me in the right direction that would be great.

Try putting @babel/preset-env inside an array. Like so:

{
  "preset" : ["@babel/preset-env"]
}

Thanks you @davejandrea I went over the lesson again and found the answer, which was the same as yours :wink:

1 Like