简体   繁体   中英

How to start a nodejs project with only index.js and package.json and node modules files

I have three files -- Index.js -- Node Modules -- Package.json

I need to run this project I am using

 npm start

But getting the below error

npm ERR! missing script: start

Then i have used the below command in package.json

start:"node index.js"

Then the project is running but coming out of loop like the below

admin@DESKTOP-ASA7V3C MINGW64 /e/Trigger Email Fucntion
$ npm start

> skill-sample-nodejs-fact-i18n@2.0.0 start E:\Trigger Email Fucntion
> node index.js

Loading function

admin@DESKTOP-ASA7V3C MINGW64 /e/Trigger Email Fucntion
$

So please help me how to start the node js project and not to stop unless we stop it

Expected Result:

The project needs to run by using npm start

What you're experiencing is the expected behaviour, code exits once it's execution is complete. You can use nodemon , it will detect the changes and automatically start the node application. I hope this is what you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM