NPM - Node Package Manager
Problem Statement -
1. Perform the below mentioned steps by creating package.json file named npm_commands.
(a) Create a file named index.js
(b) Write a JavaScript code in index.js file to create a string named myVar and value as node package manager and convert it into uppercase.
Note: Please use console.log to display the output of myVar in index.js
2. Configure scripts in package.json
(a) to check the versions of npm and node by using npm run release | tee output1.txt
(b) to execute index.js by using npm run build | tee output.txt
1. Inside challenge folder, create a JavaScript file named index.js and type the following code in it -
myVar = "node package manager"
console.log(myVar.toUpperCase())
2. In the terminal, type the following command -
npm init
Different properties would be shown. By default, the package name would be challenge.
Enter "npm_commands" next to it.
Node modules would be created.
3. In package.json file, in scripts section, write the following scripts-
"release": "npm -v && node -v",
"build": node index.js
4. Now, in terminal, run the following two commands -
(a) npm run release | tee output1.txt
(b) npm run build | tee output.txt
Comments
Post a Comment