What should be NPM command for solving this question?

Viewed 2651

I tried various solutions for this question but not able to pass 2 test cases amongst 4. Please help me crackdown this problem

Perform the below mentioned steps by creating package.json file named npm_commands in the maxbot directory

  1. Create a file named index.js.
  2. Write a js 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 file

  1. 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 Answers
  1. npm init - to initialize new package
  • give npm_commands as package name
  • give index.js as start file
  1. Create new file named as index.js
  • declare : let myVar = "node package manager"
  • print var in uppercase: console.log(myVar.toUpperCase());
  1. Add these scripts in package.json
  • to check npm and node version: "release": "npm -v && node -v",
  • to execute index.js file: "build": "node index.js"
  1. Save and then run these commands to get the results:
  • npm run release | tee output1.txt
  • npm run build | tee output.txt
Related