I am running my web app with npm start
but now I need to deploy it to Digital Ocean which means that I'll have to use forever
to start my app and I can't figure this out...
I tried to run it as forever npm start
but it returns:
error: Cannot start forever
error: script /root/saleseng/OP Apps Platform/server/npm does not exist.
This is my scrips
object from package.json
:
"scripts": {
"start": "nodemon --watch src --exec babel-node -- src/index.js",
"test": "echo \"Error: no test specified\" && exit 1"
}
You will need to pass the name of .js
file to forever:
forever start src/index.js
This will start the script with forever. It could be monitored with
forever logs scriptId -f
forever list
will fetch you the scriptId
UPDATE:
Transpiling to ES5
:
To use babel
have the following dependencies installed:
"dependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.24.1",
"babel-core": "^6.25.0",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
}
Then create a .babelrc
in the root of your project having the following:
{
"presets": ["es2015","stage-0"]
}
Now to finally do a transpile, run:
babel myInputDirectory --out-dir myOutputDirectory