installing web pack 2 code example Example 1: npm webpack npm install --save-dev webpack Example 2: npm webpack yarn add webpack --dev