Cannot do actions in CMD bash when running server - javascript

I'm just starting to learn meteor.js. I used the command line to create a project and run it on my local server. However, when I do such a command as 'meteor' in my meteor folder, it starts running my server, but it disables to do anything further in command line. I can't type anymore or anything. What is wrong?
I'm running it on windows 8.

Related

Stripe is not recognized by the terminal in VS CODE

Upon running 'stripe listen' command in terminal in VS Code, it throws an issue :-
The term 'stripe' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that
the path is correct and try again.
Can anybody help me in resolving this?
I have already configured Stripe-CLI for my project using command prompt but it is not working in the terminal of vs code.
You can restart your vscode and then try running your command, if it is running in command prompt outside of vscode. VScode terminal uses available system CLIs like command prompt,powershell & others, so whatever is running outside of vscode terminal, should run in vscode terminal as well.
If your command is not running outside of vscode as well, you can check the PATH variable in your system environment variables (search for environment variables in start menu, assuming Windows OS), whether it contains the path to the folder containing stripe executable file or not. You can add the path if it is not present, then restart your terminals/vscode and try running your command.

Issue related to running of New React App

I installed Nodejs(v 10.16.0 LTS) and then using Windows Powershell I run following commands
npx create-react-app my-app
cd my-app
npm start
The actual problem I am facing is that if PowerShell window is opened in the background, then my code works properly. But when I close PowerShell and reload Browser Tab, the error occurs which say
This site can’t be reached
localhost refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall.
Kindly help me to figure out this issue. Thanks
When you close PowerShell window you terminate your React app as well, it has to stay opened. Running npm start kicks off local server with your app running. If you want to have possibility to have application running with terminal closed you can use libs like https://www.npmjs.com/package/forever, but I do not recommend that- it's easy to forget you have one app instance running already :)
When you run the command npm start, this is the expected behaviour. This command spawns a new npm instance in the directory from where you have executed it and directs it to start a server. The catch here is that the server runs as an attached process with PowerShell, by default and it is bound to terminate once you close the PowerShell window.
To manually detach a process from the terminal, we use an & after the command on a UNIX-based system (Linux, MacOS etc.) something like npm start &.In case of PowerShell, you can make use of a built-in function called Start-Process like this -
Start-Process -NoNewWindow npm start
If you'd like to read more about it, you can refer a blog post here - https://ariefbayu.xyz/run-background-command-in-powershell-8ea86436684e

pm2-windows-startup stopped working after Windows reinstallation

I use PM2 module and pm2-windows-startup utility to automatically run Node.js when Windows startups. It was working perfectly during a few months, but recently once I reinstalled my Windows, the utility stopped working.
When I run Node by command promt with
pm2 start myapp.js --watch
I get the message
PM2 is being successfully deamonized
Then if I run the command
pm2-startup install
I get
Successfully added PM2 startup registry entry.
And then if I run
pm2 save
I get
PM2 is being successfully deamonized
Saving current process list...
Nothing to save !!!
But if I restart my computer, the utility doesn't start Node.js
How to resolve the problem?

Using forever command to run node.js script on heroku

So, I searched a lot before asking this here as I was not able to find a single answer related to this small problem.
I want to run node.js file on my heroku server which is on free-tier but I don't want to use node file.js. I want to use forever start file.js.
So, I did wrote the commands in my package files as well as defined a Procfile for worker: forever start file.js.
And deployed to heroku, but all the logs says that
forever: bash command not found.
Any solution ?

Install Node.js

I'm completely new to node.js. By reading the documentation and tutorials, I managed to download and install node.js on my windows.
How do I test it and make it work?
The file test.js is saved in the same directory as node.exe and contains:
console.log('Hello World');
Openning the command-line I typed:
$ node test.js
But nothing hapenns, just:
...
You are typing node test.js in the Node REPL not the command line. The ... is indicating that you haven't reached the end of a valid statement yet (because you are writing shell and not JavaScript).
Run a command line with your terminal emulator of choice (probably Windows Powershell if you are using Windows).
Run the Node REPL by executing node via the command-line without any arguments. The reason you're not getting the expected results is probably because you're running node.exe directly. Since you're using windows, start up CMD and run node.exe from there. Once you have the REPL running, try node test.js again, and this time it will work.
![enter image description here][1]I have run it in nodejs shell and it is simply working
> console.log('Hello World');
Hello World
undefined
>
Also I opened nodejs command prompt not default command prompt of windows and then
node path_to_file
it is working... same output

Categories

Resources