How to setup a package script in Nodejs project

Package.json in a Nodejs project is the configuration file for your project. In the file we can configure multiple running script.

We can run the script with npm command in the console. Let’s fin configure our first custom script for app.js file.

 "scripts": {
    "start": "node ./app.js",   
    "test": "echo \"Error: no test specified\" && exit 1"

We can now run the script as npm start .

Published by


A developer,teacher and a blogger obsessed with Python,Dart and open source world from India

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.