When I am running the application using npm start I can able to run the application without any error.
I have installed pm2 to run node from now on.
I am using the command PM2 start npm start:
then I am using PM2 logs npm command I am able to see the application running in the terminal:
But when I'm running the browser nothing is running.
Nothing is also running when I'm running the browser.
Your npm start will most likely be a command with the node prefix, to run pm2 on a node project you'll have to NODE_ENV=<insert env> pm2 start node server.js and for react you'll have to pack/build your project and do pm2 start http-server -p <insert port>.
Other ways off running this forever is through nginx etc.
Hope this helps :-)
Related
Installed nodejs and npm package on windows. No problems while running commands locally, but on SSH powershell (remoting in), it says "node" command not found. Similar results from npm command too.
I am using azure functions core tools from a cloned repository with a shopify microservice. The project setup has these steps:
npm install
npm run build
npm run typed-az-func -- push
npm run typed-az-func -- push --execute
npm run typed-az-func -- pull
I was logged in on azure using the azure-cli. In the last command (npm run typed-az-func -- pull), I've encountered some errors:
Command errors
I'm running Ubuntu 20.04.3 LTS
and installed Azure Function Core Tools from this: https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v3%2Clinux%2Ccsharp%2Cportal%2Cbash%2Ckeda
There's a high chance that your npm cache been damaged.
Try npm cache clean --force command before npm run command and this should resolve the issue.
I'm new to MEAN projects and I have a new project I've successfully cloned and need to get running locally to develop against. I have no idea where to start.
It has things like docker, lerna, yarn, etc. How can I get this working on my local dev machine? I have PC and Mac resources as well as resources like Azure and AWS (Cloud9).
Update
I had to do things like the following to get it up and running. Now, this took a few minutes to run. My question now is, will I have to stop and start this process each time I make a change (the npm run dev part, I mean)?
npm -v
nvm ls
nvm install 8.9.4
node -v
nvm alias default 8.9.4
ssh-keygen
cat ~/.ssh/id_rsa.pub
git clone <repo>
copy .env.dev
copy .env.local
Database connection strings
npm install -g lerna yarn pm2
sudo pip install docker-compose
export NPM_TOKEN=00000000-0000-0000-000-00000000000
echo $NPM_TOKEN
lerna bootstrap
npm run dev
I am using Windows Server 2008 R2 EE OS. In which I have npm package manager. I am trying to run the below command to install Selenium Webdriver package.
Command:
npm install selenium-webdriver
I am receiving below error while doing it.
Error:
node.js npm should be run outside of the node repl in your normal
shell
You are running the npm command inside the node shell.
Open another shell and just type "npm install bla-bla", npm should be on the PATH. Or cd to its directory and type command.
See my command images
Doing it wrong
Doing it right
In the case of windows, sometimes it is bad to consider that the npm will create folder itself for what it required.
The best is to manually create npm folder like "C:\Users\username\AppData\Roaming\npm".
Hope this help.
By creating a folder C:/Users//AppData/Roaming/npm solved my problem.
i'm trying to code a whiteboard app. AND i'm using socket.io for real time comm.. To do that, i'm logging in my VPS via putty and I'm starting the server like "node server.js", but when I log off from VPS (closing putty) normally the server shuts down. So, how can I solve that problem?
in your server console hit this command firstly this will install forever module
$ sudo npm install forever -g
use sudo according to your permission in your server
then hit this command in your server console
$ sudo forever start server.js
Another alternative is to use tmux so that the terminal doesnt dies when you logout of your VPS.
For ubuntu, apt-get install byobu
and in the byobu terminal use node server.js
Then you can exit the VPS without killing the terminal process.
Not recommended for production use.