0

I'm trying to run 'npm start' from a file : test.js . I get :

(function (exports, require, module, __filename, __dirname) { npm start
                                                              ^^^^
SyntaxError: Unexpected identifier

The content of test.js :

npm start 

What I'm trying to achieve is to avoid starting my node server with npm start directly in the shell and start it with:

node test.js

And programmatically restart my node server at three differents hours a day.

I'm not node expert. Can anyone help me or give me ideas to achieve this ? Thank you.

John
  • 185
  • 1
  • 4
  • 21

1 Answers1

1

npm start is not a valid javascript code rather it is a command meant to be used from the terminal. To do scheduled restarts you can use modules like pm2.

shawon191
  • 1,824
  • 12
  • 26