node -vinside a terminal window (such as
cmd.exeor PowerShell) to check the currently installed version.
mkdircreates our project directory, the directory name can be changed to anything suitable - it does not need to remain
cdcommand changes into the newly created directory (making it the working directory).
npm, optionally with the
-yflag to skip the prompts and generate a default
--saveflag when installing, it will be much easier to see which dependencies are installed by looking inside the
importsyntax, when developing we will need to add a line to our
package.jsonin order to prevent a
SyntaxError: Cannot use import statement outside a module. The
importkeyword was introduced in Node.js v12, a language feature to simplify the use of modules. Alternatively, we could use an
package.jsonenables us to keep the
.jsfile extension and saves a lot of hassle with configuration :
require()syntax, then it is unnecessary to add this line to