CraftAcademy/CraftOverflow

Did you mean "@babel/env"?

Opened this issue · 0 comments

CA-ma commented

Problem

This is an error related to the Babel compiler (Did you mean "@babel/env"?) found in the Address Book challenge documentation as written for the cohorts of April 2019 and June 2019. It appears during the webkit and babel installation, near the end of the scaffolding process with Yarn.

Background

This issue has been seen in various forms at CraftOverflow previously:
#33
#38

Implementation code

During the scaffolding procedure as discussed in the course material as of June 2019, the installation of webkit and babel is recommended as follows,

yarn add webpack webpack-cli babel-loader babel-preset-es2015 babel-polyfill babel-register --dev

which results in an eventual error from the yarn run build command,

Screenshot 2019-07-11 at 7 46 56 PM

With the help of Faraz, we settled on the solution of,

  1. running yarn add webpack webpack-cli babel-loader babel-preset-env babel-polyfill babel-register --dev
  2. Replacing in the webpack.config.js file, presets: ["es2015"] with presets: ["env"].
  3. deleting the yarn.lock file.
  4. Modifying the package.json file as follows,
{
  "name": "challengeRockPaperScissor",
  "version": "1.0.0",
  "main": "index.js",
  "repository": "https://github.com/CA-ma/RPS_challenge.git",
  "author": "Max Aubain <max.aubain@gmail.com>",
  "license": "MIT",
  "scripts": {
    "build": "webpack --progress --p --mode=production",
    "watch": "webpack --progress --watch --mode=development",
    "cucumber": "superstatic -p 3000 2> /dev/null & cucumber-js; lsof -ti tcp:3000 | xargs kill"
  },
  "devDependencies": {
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-register": "^6.26.0",
    "chai": "^4.2.0",
    "cucumber": "^5.1.0",
    "mocha": "^6.1.4",
    "puppeteer": "^1.17.0",
    "superstatic": "^6.0.4",
    "webpack": "^4.34.0",
    "webpack-cli": "^3.3.4"
  },
  "dependencies": {
    "@babel/core": "^7.4.5",
    "babel-core": "6",
    "babel-loader": "7",
    "babel-preset-env": "^1.7.0"
  }
}
  1. running yarn add babel-preset-env.
  2. And finally running yarn run build successfully.

Markdown guide