intial setup
npm int
it will ask name, version 1.0.0., description, stating file means app.js or some other
it will generate package.json file
in pacckage.json file
like bwlow contents
{
"name": "tutorials",
"version": "1.0.0",
"description": "tutorials",
"main": "first.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"node first.js"
},
"author": "",
"license": "ISC"
}
node filename
filename may be first.js or app.js
then run the file and it wil show
create first.js
file
write the content in that file
console.log('vamsi');
when u run after reach that location
in terminal
node first.js
it will show console.log data as vamsi
after taht
in package.json file
write start in scripts node first.js
whenever run npm start
it will run automiatically node first.js
No comments:
Post a Comment