0
0
Node.jsframework~10 mins

Running scripts with node command in Node.js - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run a Node.js script named app.js from the command line.

Node.js
node [1]
Drag options to blanks, or click blank then click option'
Aapp.js
Brun.js
Cindex.html
Dscript.py
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to run a non-JavaScript file like script.py with node.
Forgetting to include the script file name after node.
2fill in blank
medium

Complete the command to run a script named server.js located in the src folder.

Node.js
node [1]
Drag options to blanks, or click blank then click option'
Asrc\server.js
Bsrc/server.js
Cserver.js
D./server.js
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslashes \ which may not work on all systems.
Omitting the folder path and just typing the file name.
3fill in blank
hard

Fix the error in the command to run app.js when the user typed node app.

Node.js
node [1]
Drag options to blanks, or click blank then click option'
Aapp.js
Bapp.jsx
Capp
Dapp.json
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the .js extension.
Trying to run files with wrong extensions like .jsx or .json.
4fill in blank
hard

Fill both blanks to run a script named index.js located in the scripts folder using a relative path.

Node.js
node [1]/[2]
Drag options to blanks, or click blank then click option'
Ascripts
Bindex.js
Csrc
Dmain.js
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping folder and file names.
Using wrong folder or file names.
5fill in blank
hard

Fill all three blanks to run a script named server.js inside the src folder inside the app folder located in the current directory.

Node.js
node ./[1]/[2]/[3]
Drag options to blanks, or click blank then click option'
Aapp
Bsrc
Cserver.js
Dmain.js
Attempts:
3 left
💡 Hint
Common Mistakes
Missing the current directory prefix ./.
Using wrong folder or file names.
Swapping the order of folders and file.