node js and xampp conflicts - node.js

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?

Related

Apache httpd and Easy Apache 4 (Installing mod_wsgi for python app)

It's been a while but I am running into an issue and could not find any answers elsewhere.
I pay for a dedicated server that is running Easy Apache 4 with Centos 7. I have root access to everything so no limitations.
I am in the process of deploying a Python/Django app on the server for a client. When trying to install mod_wsgi it errors out stating it needs the package httpd-mmn. I can install the httpd module using yum but I am worried about conflicts since the server is using Easy Apache 4.
Is this a relevant concern? I have a bunch of php sites on my server and I am afraid I'll break it.
For the record, I do not want to use the experimental easy apache mod wsgi as it's, well...experimental and a use at your own risk situation.
Any thoughts or recommendations would be great.
mod_wsgi is often built for a specific version of apache.
You are getting errors because your apache was installed by easyapache4.
I suggest you go with the experimental version for 2 reasons
You really don't have much of an option, unless you want to build everything yourself from ground up.
the ea-apache24-mod_wsgi has been available for install for at least 6 years now and I have searched thru the web and none has complained of errors or breaking things
If you (or anyone else) choose to go the experimental route, the process is
yum install ea4-experimental
yum install ea-apache24-mod_wsgi
Then modify the virtual host configs by creating directives and including these files
/etc/apache2/conf.d/userdata/std/2_4/{user}/{domain}/{includename}.conf
/etc/apache2/conf.d/userdata/std/2_4/{user}/{domain}/{includename}.conf (for SSL)
When done run this 3 commands to update the configs
/scripts/verify_vhost_includes
/scripts/ensure_vhost_includes --user={user}
/scripts/rebuildhttpdconf
Make sure to backup your httpd config before this step above
Finally restart your httpd and you should be good

Nodejs and raw-socket package

I have a nodejs application that should start when I turn on the machine (I'm using Linux Ubuntu 16.04 so I put it in the rc.local). my application uses the raw-socket package.
Since my application cannot run as root, in the rc.local, I set:
sudo -u myuser node myapp.js &
when my application calls "new raw-socket", I got an error:
Operation not permitted.
I tried different methods such as "setcap" but they don't work for me.
Furthermore, if i try to run my app after the operating system is loaded, the app works perfectly without any problem....
should I have to add something in the rc.local....did I miss something?
node-raw-socket needs root access to create its raw sockets.
You will have to run
sudo node myapp.js

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.

Nodejs is not available outside of its installation directory

I installed nodejs 64bit on my windows8.
NOTE: By install, I mean I used node-v0.10.35-x64.msi andn its Windows8 for SurfacePro3.
I am not familiar with add PATH. What exactly should add I add and how I run it after I added it?
However, nodejs will not be available outside of its own installation folder.
For example,
if I installed it at /www/test directory, then it will not available either in www or any level after test, like, /www/test/anothertest. Only /www/test will have node running.
I test it by write node -v on /www/test directory in command prompt. I consider its available when it returns me the node version number. When it is not recognized, it will say 'node' is not recognized as an internal or external command...'
I insta
Restart your computer always fix everything....
Yes it did now everything works lol

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