Step 1: Begin by running the command "npm init" to generate a package.json file in your project directory.
Step 2: Install the external package "three" by executing the command "npm install three", which will download it into the "node_modules" folder.
Step 3: Create your own .js file, for example {in your package directory}/<yourMainFile>
.js. Remember to update the "main" attribute in your package.json to point to "<yourMainfile>
.js".
Step 4: Visit https://www.npmjs.com/package/three for usage instructions on the "three" package, then write sample code in <yourMainFile>
.js
Step 5: To test the result, run:
$ node ./<yourMainFile>
.js
- If using git bash CLI, make sure to use "./".
Step 6: If your <yourMainFile>
.js file includes console.log("hello or any other message"), you will see the output displayed in the console.