Node http-server persists port 8080 even after they were close - node.js

First, this is my configuration:
Windows 7 Professional
Node v0.12.2
NPM v2.7.4
http-server v0.8.0
I've installed http-server using npm install http-server -g, still on terminal, gone to my root folder ...\node\teste and executed http-server -a127.0.0.1 -p8080. Until this part everything seemed ok. The server was up and running.
When I accessed the url localhost:8080, it gave me a download file back as an answer, my index.js.
Shutdown the server with CTRL+C at the terminal, made some changes in file, up the server again and a download file as response again, but not the actual file it was the first one I've downloaded and deleted.
So, I've changed my original file name, stopped the http-server function, cleared the ports so that was not shown in netstat -a -b and I can still access localhost:8080 and download the file. Even restarting my PC.
There is no node process running, I've checked.

After all that effort, which can be considered part of the sollution, I finally found what as the last piece of the puzzle.
I've gone to my broswer(Google Chrome) and oppened:
Settings > Advanced Settings > Privacity > Clear Data
And cleared all my broser data.
Then localhost:8080 is free now.
Wanted to share this information so nobody will lost hours, like me, trying to find answers.

Related

node js and xampp conflicts

I run an apache server on localhost using XAMPP and this will mostly work with no problems.
Ocassionaly when I run npm install on a project to install it's dependencies, my connection to the apache server is disrupted, I am unable to access any webpages, I cannot turn off my apache and my machine will not even shutdown and I have to hard reset.
Does anybody know what is happening here and how I can
a) get myself out the situation when it occurs
and
b) prevent it from occurring
I've tried to kill the node processes using pkill node with no success.
Once I hard reset the machine I no longer have any issue.
I believe my problem to be becuase of the fact that I run npm install from inside my htdocs folder which is where apache will usually run from so the obvious solution would be to not do that but does that mean that if an project folder I want o use runs with node that I cannot use xampp?

GitBash - can't enter a new command after starting npm

The solution to my problem may be simple but since I'm a beginner on command line and npm it's been hard to solve it by myself, hopefuly you know the solution:
I cloned a repository and then started npm in the command line. After I enter the command 'start npm', it shows in console that webpack was succesfuly compiled but after no matter what I input, the command line does not execute anything neither shows an error message. I've tried to input, as I've done before, a new command but it seems to add text and not a command. (see the picture)
Or if it is not a problem and i'm just misunderstanding something, please tell me.
After I enter the command 'start npm'
Judging by the image you provided, this command is starting the Webpack dev-server. This is a web server for testing your application, which will monitor your files and rebuild your app when any changes are detected. Once the server is running in a terminal, any further input on your part will be ignored. You can stop the server using Ctrl + C.
Or if it is not a problem and I'm just misunderstanding something, please tell me.
The server instance will (in its default configuration) be listening for connections from localhost on port 8080, so (depending on how your app is set up), it might now be enough to visit http://localhost:3000 in your browser to see your project running. If that's not the case, check the output in the terminal window for something like: Project is running at http://localhost:3035/
It might also help to have a look in package.json to see what else (if anything) npm start is doing.
Further reading: https://github.com/webpack/webpack-dev-server

React create app hot reload is not always working on linux

I created a react application using create-react-app boilerplate, which seems to be very popular, hot reload some times updates when any of the files changes and some times not, seems like there is a minimum duration or something like that, I'm using Ubuntu, node version 7.0, the script in package.json is npm:'react-script start' what I am missing ?
When npm start doesn’t detect changes, below are the common troubleshooting steps provided in the create-react-app documentation - link.
While an app is running with npm start and updating code in the editor should possibly refresh the broswer with the updated code.
If this doesn’t happen, try one of the following workarounds:
If the project files are directly synced to your local system from a cloud storage like Dropbox or Google Drive and you're trying to run the app in them directly, try moving it out.
Due to Webpack bug, you may need to restart the watcher. If the watcher doesn’t detect the index.js and you’re referencing it by the folder name.
Safe write feature in editors like Vim and IntelliJ currently breaks the watcher. You will need to disable it.
Due to Webpack watcher bug, projects with path contains parentheses causes issue, try moving the project to a path without them. .
To allow more watchers in Linux and macOS, you might need to tweak system settings.
If the project runs inside a virtual machine such as (a Vagrant provisioned) VirtualBox, create an .env file in your project directory if it doesn’t exist, and add CHOKIDAR_USEPOLLING=true to it. This ensures that the next time you run npm start, the watcher uses the polling mode, as necessary inside a VM.
Could try increasing max_users_watches- link
More references:
Issue Tracker 1
Troubleshooting webpack
Issue Tracker 2 - Webpack polling
Try these:
Turn off safe write in your IDE
Increase max_user_watches
Your path should not have parentheses
as last resort try to use this as your env variable:
CHOKIDAR_USEPOLLING=true npm start
Sources:
https://github.com/facebookincubator/create-react-app/issues/659
https://github.com/facebookincubator/create-react-app/issues/1049#issuecomment-261731734
I was able to make this work using:
sudo npm start
run this command
sudo -i
echo 1048576 > /proc/sys/fs/inotify/max_user_watches
exit
try deleting the node_modules folder and reinstall
by using cmd npm install
worked for me ( ubuntu 18.04.3 LTS )
In unbuntu, i basically kill all the process running on port (for react app default is :3000).
List all the process running on port 3000.
lsof -i :3000
This command will show something like this.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 7429 yipl 19u IPv4 1081760 0t0 TCP localhost:3000->localhost:35762 (ESTABLISHED)
chrome 26448 yipl 177u IPv4 1080082 0t0 TCP localhost:35762->localhost:3000 (ESTABLISHED)
Now kill the process by PID.
kill -9 7429
kill -9 26488
Start your react app again.
Apparently hot module reloading only works out-of-the-box if you eject your app.
But if you haven't ejected your app, then you can follow these instructions to get it working.
Find the ReactDOM.render(...) at the top of your app, and add these lines below it:
ReactDOM.render(...);
if (module.hot) {
module.hot.accept('./App', () => {
// --- Copy-paste your usual ReactDOM.render(...) call here: --- //
ReactDOM.render(...);
});
}
The instructions linked above also show how to hot reload things outside of the component tree, such as redux reducers.
One additional case I just experience is when using multiple version of nodejs with NVM in parallel. Basically, I have two terminal windows, one run node 10.x, other on node 9.x, and Webpack watcher stops seeing change.
The solution is to bring both to the same node version
sudo npm start
i dont know more about linux, but it is probably due to firewall settings, as i have done the same in windows and there to start react dev server we need to give the access through firewall, so to do the same here we need to give it the admin permision(sudo in case of a ubuntu linux distribution).
If you start your app with a bunch of errors it seems to stop watching your files and thus will not detect your fixes to the broken files. It seems as if you need to initiate "start" with not too many/severe errors for the file watcher to work.

Missing file or plugin on freshly installed Cloud9 ide?

I'm currently trying to set up cloud9 on my debian server for node.js development. I followed some simple steps as described below, but there seems to be missing something and I would like to know how this can be resolved in the best way. Of course, I could start looking for the missing file on the web and put it there, but I think that's not the way to go.
What I did is this:
ssh'ed into my Debian server into my home folder
sudo git clone https://github.com/c9/core.git sdk (completed succesfully)
cd sdk
sudo ./scripts/install-sdk.sh
The installation finishes like this:
Success!
run 'node server.js -p 8080 -a :' to launch Cloud9
When I then start up the IDE with this command:
node server.js -p 1234 -l 0.0.0.0 -a rob:mypass -w /home/rob/myproject/
...everything looks good:
Starting standalone
Connect server listening at http://x.x.x.x:1234
Using basic authentication
CDN: version standalone initialized /home/rob/sdk/build
Started '/home/rob/sdk/configs/standalone' with config 'standalone'!
Cloud9 is up and running
and I can basically reach the IDE from my local browser. The problem is that it stops on the welcome screen with this loading indicator in the middle right under the cloud9 logo. The JS console shows a missing file (I've replaced my real URL):
http://myserver.de:1234/static/plugins/c9.ide.collab/notifications/bubble.js Failed to load resource: the server responded with a status of 404 (Not Found)
I then looked into the folder /home/rob/sdk/plugins/c9.ide.collab/, but it is empty.
What am I missing? Do I need to install something with npm or do I have to change the package.json file somehow? I'd really appreciate some help because I think wildly modifying and copying in files won't make things better.
edit: It turns out it was "bug in the script updating references [of some plugins]". Details: https://github.com/c9/core/pull/365
—Cheers!
Original answer:
I think think the c9.ide.collab plugin's refspec is wrong here: https://github.com/z3cka/core/commit/5f45ea38f422160a0030c5ef8d1efb19231bc78c#diff-b9cfc7f2cdf78a7f4b91a753d10865a2
I changed it back to #54aa1cbee0, ran the install-sdk.sh and it grabbed the latest version of the collab plugin. While prepping a PR, I just found 3 more plugins with bad refspecs
c9.ide.language
c9.ide.language.javascript.eslint
c9.ide.run.debug
I'm currently working on a fix for the rest of these.

Cloud9 on Raspberry Pi, Unable to save files

I'm trying to get the cloud9 local server working on my Raspberry Pi(512mb model B, running raspbian).
I followed this installation guide:
http://www.slickstreamer.info/2013/02/how-to-install-cloud-9-on-raspberry-pi.html
After this installation everything appeared to be working properly, I can start the server with the following command:
~/cloud9/bin/cloud9.sh -l 0.0.0.0 -w ~/Documents/www/workspace/
when I start the server all the files in the workspace are displayed properly and I can view, duplicate, delete, and create files remotely no problem. But when I edit an existing file and try to save it remotely a little spinning wheel pops up on the tab of the file I'm saving and it continues to spin endlessly.
When I start the server a warning pops up saying: 'path.existsSync is now called fs.existsSync.' I'm not sure if that is relevant or not.
I found another thread somewhere saying that I should go through cloud9/configs/default.js and replace any instance of localhost with 0.0.0.0. I tried that, but it didn't fix my problem.
Does anyone have any suggestions about how to get cloud9 saving files properly?
Thanks in advance for your help.
There were several complains about IDE file saving hangs on cloud9 support. At the bottom of the page there is a solution you can try.
I fully removed cloud9 and node(followed these directions to remove node: Uninstall Node.JS using Linux command line?), and then did a clean install following these directions: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=30265. In addition to those commands I also had to run the following:
sudo npm install formidable
sudo npm install gnu-tools
sudo npm install xmldom
after that I was able to start the cloud9 server without issue, and now I'm able to save files.
thanks for trying to help

Resources