Do i need to install some packages to run javascript on debian - javascript

I have to set up a web server using a existing code done by an other intern.
I have a web server on debian, I've already set up the web server and it works.
When I copied his code on the server, I noticed that it doesn't work perfectly.
His code contains some javascript and I want to know if I have to download some further packages on my debian server to let it run properly.
I have tried his code before on a WAMP server and I didn't got a problem when runnig his code, that's why I thought that maybe the reason was the javascript present on his code.
I've done some research on google and I have many links on Node.js but I can't really understand how It will solve my problem.
Thank you for reading my post and also for your answers!!

Perhaps you can try this:
https://packages.debian.org/squeeze/javascript-common
I am interested about debian too, but still a newbie here...

Related

NodeJS from localhost to online site

I have a site that I created using NodeJS and one page html/jquery everything is working as expected on the localhost provided but I'm getting some issue in putting that site online www.xxxx.com, I already got a .com domain but I don't know which configuration should I do on my site and on code , which mean is there steps to follow on the app.js which contain the localhost:3500 ?
This is the structure of my folder developped under VSCODE
and this is my statement app.js of the localhost
//start the server.
app.listen(3500, function () {
console.log('Example app listening on port 3500!');
});
Hope I mentioned everything
Best Regards
To host a website you don't' just need the domain name (.com) but you need the server and hosting as well.
Here you can find details:
Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu using NGINX (free and open-source)
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
For Windows:
https://www.rapidvaluesolutions.com/tech_blog/nginx-server-deploying-web-applications/
If you're like me who doesn't want to get into the configuration details of the host server, check out heroku. It's a platform-as-a-service that allows you to host a site really easily and it has a pretty generous free-tier. Not much will have to change code-wise maybe just making the port a variable.
One major issue I had with the platform is that you cannot save files on the filesystem using code, you'll have to use an external file storage like AWS.
The other, slightly minor issue is that you need to be using git to push your code to the heroku servers (Not really an issue tbh since you really should look into git if you aren't using it already)

scrape external website that requires javascript being triggered

Since phantomjs is abandoned, I would like to know if there is any alternative method. e.g. chrome-webdriver wouldn't be a good solution as it wouldn't be able to run on a remote host such as heroku.
So, is it somehow possible to scrape an external website that require javascript being triggered first? Note that it should be possible to run it from a nodejs application.
I was getting ready to put together something for you, then I thought better and google'd it. Check out this build script; it seems to answer your question exactly.
https://github.com/stomita/heroku-buildpack-phantomjs
Set up a git branch and pull it locally if you have to, but this should work. Basically, you need to download the binary and then remote in and run "heroku run 'phantomjs'" or "heroku run 'bin/phantomjs'"

Client-side only AngularJS app

I am a little confused about how to run an AngularJS app.
Let me explain: my team and I are trying to make a project that will have a web service that the client side uses (written in JavaScript+HTML in AngularJS ), my problem is with the client side (some basic understanding).
I have seen the angular example but I don't want to use node and I have a little problem understanding something; how can I start my app(only the client side)?
how can I start it on my local computer so that the routing and everything will work without nodejs(because it doesnt work with file:// )
in general how can I start a site like this on a server with out something like node.
This is no my first website just in this format I never did from scratch and
I think I am missing some basic understanding I tried to research it but got all confused.
how can I start it on my local computer so that the routing and everything will work without nodejs(because it doesnt work with file:// )
Install a webserver
in general how can I start a site like this on a server with out something like node.
Install a webserver that isn't one you wrote using NodeJS. There are plenty out there.
You can do on your local computer using xampp or wamp server.
Same code will work on other server also like godaddys etc.
NOTE: Use relative path instead of absolute path.

How to make AJAX work on local server using XAMPP or node.js

I am at my wit's end and I'm hoping someone can help.
I have been trying to get AJAX to work on a local server, but I don't know where to begin even with the most basic code. I have downloaded node.js and XAMPP and I have been looking online for tutorials on how to get even AJAX test sites to work.
If anybody knows of a step-by-step tutorial on how to get the most basic AJAX functions to work on node.js or XAMPP I would appreciate it so much. Everything I've found seems to assume the person reading already knows how to begin working with a local server to make the code work. I know what code I need to write from all the examples, I just don't know how to get it to work on XAMPP or node.js! Thank you.
is XAMPP working? can you access it via http://localhost?
AJAX is just javascript that can send requests without reloading the entire page. it doesn't need anything special to work.
however its important that localhost is working and keep note if you need to add a port to the end of the url to get it to work.
then add your html/php file into the htdocs folder of XAMPP and navigate to it using the localhost url.
In case you have Visual Studio installed. Click
File Menu
Open
Web site
Select the website folder
Hit F5 to run the app
First, you have to create your html file; do it in the "htdocs" folder of XAMPP, which is likely to have its folder on your C: hard drive path, unless you moved it elsewhere.
Secondly, start XAMPP Apache server. Now you can access your html web page via web browser at "localhost/yourwebpage.html".
Hope this help everyone!

Javascript not working on localhost, but it is working on Live site

I am facing JavaScript problems on XAMPP Localhost. The Collapse Buttons, go to top button and jQuery news feed are not working on every site on my localhost.
But Facebook, Twitter, Plusone buttons load correctly from remote server i.e. from the respective Social Sites.
So, I think it narrows me to the point that the JavaScript files hosted locally are not executed while those from Facebook etc. are getting executed.
I tried reinstalling XAMPP but didn't work.
I know this is old but, I had the same problem and found this question while searching a solution. But I have lampp installed on ubuntu and since Linux asks permission to execute ANYTHING, the local js files which resided in htdocs were without permission. After:
sudo chmod 777 -R /opt/lampp/htdocs
... everything was OK. Hope this helps future wanabee web developers.
It should not matter whether your files are local or not...javascript should still get executed. Try using some debugging tool like to see if you get any errors that only occur on your local machine. Because it could be that you are running some code that is depending on a domain or whatever.
I know this post is old and the answer is already given, I just wanted to give an answer of a possible reason that I encountered in case someone else finds this and it does not help.
Make sure your entire html code gets executed by viewing your page source. With me, half my code was not being executed due to a PHP error that was working on localhost with the local database but not on live with the live database. This caused the HTML to cut of from that point above my javascript.
So check your page source. If it is being cut of somewhere, find out why :)
I had the same problem. I try a lot but finally solved. The main problem was my browser cache that prevents from loading the new JavaScript file. My recommendation is that clear your browser cache data then close the browser and reopen your site again it will work perfectly.
remove any (pre in post ) blank spaces from filenames of your namespace example : localhost:port/dir /index.html
localhost:port/dir/index.html
In similar cases,
If web project site runs JS on Live Server but not on locally opened index.html,
try to check validity of HTML File Paths,
e.g you may have written:
<script src="script.js"></script>
instead of:
<script src="./script.js"></script>
Try to add ./ before file name.
./ means Current directory.

Categories

Resources