coder
asked on
Npm run not working the forever
Hi Experts,
I have issue with running npm run script with forever. Please find below forever.json
when I run forever start forever.json I get the following error
[/code]
root@ip-10-252-14-11:/home /ubuntu/wo rkarea/ntd l-2# forever start forever.json
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: npm run pack
info: Forever processing file: npm run render-prod
info: Forever processing file: npm run django8000
error: Cannot start forever
error: script /home/ubuntu/workarea/ntdl -2/npm run pack does not exist.
[/code]
with many thanks,
Bharath AK
I have issue with running npm run script with forever. Please find below forever.json
[
{
"uid": "app1",
"append": true,
"watch": true,
"script": "npm run pack "
},
{
"uid": "app2",
"append": true,
"watch": true,
"script": "npm run render-prod"
},
{
"uid": "app3",
"append": true,
"watch": true,
"script": "npm run django8000"
}
]
when I run forever start forever.json I get the following error
[/code]
root@ip-10-252-14-11:/home
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: npm run pack
info: Forever processing file: npm run render-prod
info: Forever processing file: npm run django8000
error: Cannot start forever
error: script /home/ubuntu/workarea/ntdl
[/code]
"scripts": {
"runapp8000": "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\"",
}
Please help me in resolving this issue.with many thanks,
Bharath AK
ASKER
Hi
Thanks for your response, Could you please tell me is there any way can I set the current directory each time after running one npm?
With Many thanks,
Bharath AK
Thanks for your response, Could you please tell me is there any way can I set the current directory each time after running one npm?
With Many thanks,
Bharath AK
ASKER
Hi There,
I had included the source dir in the forever.json and then I run the forever, still getting issues.
you can see from the above code script error/home/ubuntu/workarea /ntdl-2/np m run pack does not exist.
but you can see from the below line I am running npm run pack from the same folder and it is running. Please clarify where do I miss.
With Many thanks,
Bharath AK
I had included the source dir in the forever.json and then I run the forever, still getting issues.
[
{
"uid": "app1",
"append": true,
"watch": true,
"script": "npm run pack ",
"sourceDir": "/home/ubuntu/workarea/ntdl-2/"
},
{
"uid": "app2",
"append": true,
"watch": true,
"script": "npm run render",
"sourceDir": "/home/ubuntu/workarea/ntdl-2/"
},
{
"uid": "app3",
"append": true,
"watch": true,
"script": "npm run django8000",
"sourceDir": "/home/ubuntu/workarea/ntdl-2/"
}
root@ip-10-252-14-11:/home/ubuntu/workarea/ntdl-2# forever start forever.json
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info: Forever processing file: npm run pack
info: Forever processing file: npm run render
info: Forever processing file: npm run django8000
error: Cannot start forever
error: script /home/ubuntu/workarea/ntdl-2/npm run pack does not exist.
root@ip-10-252-14-11:/home/ubuntu/workarea/ntdl-2# npm run pack
> ntdl@1.0.2 pack /home/ubuntu/workarea/ntdl-2
> webpack --watch --config node/webpack/webpack.config.js
Webpack is watching the files…
you can see from the above code script error/home/ubuntu/workarea
but you can see from the below line I am running npm run pack from the same folder and it is running. Please clarify where do I miss.
With Many thanks,
Bharath AK
At this point I am not sure. Is it possible that the first run locks the file so another run cannot be made, at least until everything associated with it ends.
in words, please explain the problem you are tying to solve here and briefly what each step does. It might help to better understand the process thinking.
And to be clear, I was not sure if it moved or changed directories, just that the first run of one of those caused the script to think it no longer existed.
I wanted to blame spaces, but it works fine the first time. The only thing I can think of is the file is locked.
When it quits, can you immediately run it again and get the exact same results?
in words, please explain the problem you are tying to solve here and briefly what each step does. It might help to better understand the process thinking.
And to be clear, I was not sure if it moved or changed directories, just that the first run of one of those caused the script to think it no longer existed.
I wanted to blame spaces, but it works fine the first time. The only thing I can think of is the file is locked.
When it quits, can you immediately run it again and get the exact same results?
Looking at this again, I think the script fails right after processing the files as it just starts the loop, as the first entry does not execute and fails with a not-found. Forever always looks at the current directory for the scripts.
See this github group for ideas
https://github.com/foreverjs/forever/issues/
Specifically this one:
https://github.com/foreverjs/forever/issues/540
See this github group for ideas
https://github.com/foreverjs/forever/issues/
Specifically this one:
https://github.com/foreverjs/forever/issues/540
ASKER
Hi
Thanks for your response.
It's my bad I had used script instead of command in forever.json.
In package.json, I have
"scripts" : {
"runapp8000" : "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\"",
}
I usually run at cmd prompt npm run runapp8000 which starts the web application
In forever.json I have to use command npm run pack, but I had written at the script. it's my bad.
secondly, I don't have a script to run and forever is not running without script
I had tried the following command
it is displaying forever help options it is not running the npm command.
Please help me in resolving this issue.
thanks
Thanks for your response.
It's my bad I had used script instead of command in forever.json.
In package.json, I have
"scripts" : {
"runapp8000" : "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\"",
}
I usually run at cmd prompt npm run runapp8000 which starts the web application
In forever.json I have to use command npm run pack, but I had written at the script. it's my bad.
secondly, I don't have a script to run and forever is not running without script
root@ip-10-252-14-11:/home/ubuntu/workarea/ntdl-2# forever start forever.json
error: "script" option required in JSON configuration files
uid: app1
append: true
watch: true
command: npm run pack
sourceDir: ./
I had tried the following command
root@ip-10-252-14-11:/home/ubuntu/workarea/ntdl-2# forever start -c "npm run runapp8000"
help: usage: forever [action] [options] SCRIPT [script-options]
help:
help: Monitors the script specified in the current process or as a daemon
help:
help: actions:
.....
.....
.....
it is displaying forever help options it is not running the npm command.
Please help me in resolving this issue.
thanks
ASKER
Hi,
I dont have script to run
part of my problem is solved by running
forever -c "npm run runapp8000"
now I am able to run the application But not able to stop
but forever list provides the pid
when I stop forever stop pid
it is not terminating the process the application is still running where forever list doesn't have the process
I dont have script to run
part of my problem is solved by running
forever -c "npm run runapp8000"
now I am able to run the application But not able to stop
but forever list provides the pid
when I stop forever stop pid
it is not terminating the process the application is still running where forever list doesn't have the process
Hi Bharath, this has gotten out of my expertise for now. Let me see if I can escalate this to get others to look as well.
I have sent this to the moderators to see if we can get some other experts help. Stand by for their action. Cheers. (that is why it says "reported". Not a bad thing here.)
ASKER
Hi Owen Rubin,
I think it got reported because I pressed the bell button. I pressed it unknowingly. usually, When I press this I get a notification that it is notified for so many numbers of experts, but nowadays I am not getting this. hence I try to clicking it, features have changed, sometimes it is going to chat window. I dont know why.
,
With Thanks,
Bharath AK
I think it got reported because I pressed the bell button. I pressed it unknowingly. usually, When I press this I get a notification that it is notified for so many numbers of experts, but nowadays I am not getting this. hence I try to clicking it, features have changed, sometimes it is going to chat window. I dont know why.
,
With Thanks,
Bharath AK
Oh, at the very top there is a red flag that says "reported", but that shows up when I send the moderators a message on this. Maybe it only shows up for me?
ASKER
Hi Owen,
forever -c "npm run runapp8000" I able run the web application but when I stop forever stop it is removed from forever list but still the web application is up and running on the browser. it is not killing the complete application. Please suggest how to stop the application completely.
Please help me in resolving this issue.
With Thanks,
Bharath aK
forever -c "npm run runapp8000" I able run the web application but when I stop forever stop it is removed from forever list but still the web application is up and running on the browser. it is not killing the complete application. Please suggest how to stop the application completely.
Please help me in resolving this issue.
With Thanks,
Bharath aK
You could use the command "ps" to see all your processes running. Then use the 'kill' command to stop that process.
Use "man ps" and "man kill" to see how those command work.
Use "man ps" and "man kill" to see how those command work.
ASKER
yes,
I am able to kill the process with kill command, is there any way I can stop completely with forever command?
with thanks,
Bharath AK
I am able to kill the process with kill command, is there any way I can stop completely with forever command?
with thanks,
Bharath AK
is there any way I can stop completely with forever command?Take a look at the actions on the forever page
https://github.com/foreverjs/forever
There is a stop action which you can use to stop by
Id|Uid|Pid|Index|Script
ASKER
Julian,
When I stop with forever it says it has stopped the process. But the application is still running on the browser. it has not stopped completely.
the command I run
forever start -c "npm run runapp8000" .
npm run runapp8000 will run the 3 scripts
"runapp8000": "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\""
in package.json
"scripts": {
"django8000": "python3 manage.py runserver 0.0.0.0:8000",
"render": "babel-node node/react-render.jsx --watch",
"pack": "webpack --watch --config node/webpack/webpack.confi g.js",
"runapp8000": "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\""
},
I kill the process by
ps aux| grep node & ps aux | grep python3
to get list of process and kill each process by the following command kill -15 by processid
is there any better way to stop the process?
thanks
When I stop with forever it says it has stopped the process. But the application is still running on the browser. it has not stopped completely.
the command I run
forever start -c "npm run runapp8000" .
npm run runapp8000 will run the 3 scripts
"runapp8000": "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\""
in package.json
"scripts": {
"django8000": "python3 manage.py runserver 0.0.0.0:8000",
"render": "babel-node node/react-render.jsx --watch",
"pack": "webpack --watch --config node/webpack/webpack.confi
"runapp8000": "concurrently --no-color \"npm run pack \" \"npm run render\" \"npm run django8000\""
},
I kill the process by
ps aux| grep node & ps aux | grep python3
to get list of process and kill each process by the following command kill -15 by processid
is there any better way to stop the process?
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you all for your help and suggestions
You are welcome.
Since I dont know what each of the three runs is really trying to do, it's hard to guess what changes to make the first run fail the second time around.