MacOS – How to create a directory structure

foldersmacosterminal

I ran these commands to make the directory:

mkdir webpack-demo
cd webpack-demo
npm init -y
npm install webpack --save-dev
npm install webpack-cli --save-dev

and then type cd webpack-demo, then if I type ls I get "node_modules" "package-lock.json" "package.json"

but then when I attempt to follow the next instructions from the webpack basic set up instruction page:

  webpack-demo
 |- package.json
+ |- index.html
+ |- /src
+ |- index.js

I get the following output from terminal:

|- package.json
-bash: syntax error near unexpected token `|'
+ |- index.html
-bash: +: command not found
-bash: -: command not found
+ |- /src
-bash: +: command not found
-bash: +: command not found
+   |- index.js
-bash: +: command not found
-bash: -: command not found

What am I doing wrong?

Best Answer

The instructions use the same formatting for commands you need to enter and for output, which is confusing. Just use mkdir to create any missing directories.

PS: It seems as if the directory structure within webpack-demo is created automatically by the various commands you run (or are supposed to run), so you may not even need to create additional directories yourself.