Is there a good and easy to understand tutorial on hosting vue.js SPA application. I have currently uploaded the complete project to the server through Filezilla. And I hadn't run npm run build prior to hosting the system. Can I run npm run build locally and then upload the dist folder to the already hosted application. Any help will be much appreciated. Thanks
Yes, just run npm run build on the client and then upload the dist folder to the server. That's the normal use case, there's usually no reason to move the whole project with all the dependencies to the server.
You should run npm run build next upload files from folder dist to server. In dist folder there will be all files which are required to SPA correct working.
Related
I have VueJS project published on Netlify, what i want to do is to make modifications to this project and see my changes locally before i update the repo on GitHub and publish the changes on Netlify. So simply i'm trying to find a way to serve the project locally but this doesn't work anymore after the project got published on Netlify.
Whenever i run npm run serve i get the below error:
PS F:\Projects\reaction-timer-testing> npm run serve
> reaction-timer-testing#0.1.0 serve
> vue-cli-service serve
'vue-cli-service' is not recognized as an internal or external command,
operable program or batch file.
I assume this is because that project is in build mode and i did that by running npm run build while i was publishing it to Netlify.
I've read someone recommends to run serve -s dist and this got me no where because each time i visit the local link http://localhost:3000 it gets 404: the requested path could not be found.
Another one advised to download and install xampp but i don't know what to do next i think i've tried everything.
Here is a view of my project files (it's a very simple project that i made for learning)
Pic of project files
Link to the project on Netlify: https://reaction-timer-testing.netlify.app/
I'm new to vueJs and nuxt and i'm trying to deploy my nuxt app to my server, I tried the command npm run build and I have two files, client and server, I googled what should I do with this files but I got Nothing, So how to deploy my app to cpanel?
If your target is server (default), you indeed need to do npm run build. Then, you have a generated dist that you need to send to the server and then npm run start.
Sometimes, additional configuration is required and can be found in the deployment pages. There is no Cpanel but you maybe can find something that looks like the same here: https://nuxtjs.org/docs/2.x/deployment/deploying-to-21yunbox
I have a simple vuejs project, which does not need to communicate with server. I need to pass this project to someone does not know software engineering, so I cannot have him install nodejs and run npm run dev to run this project. Is there any way to compile this project to a single html file, so he can just open this file in chrome and run it?
If you just want to show him the project (and don't let him edit it), the obvious solution is to create a build (running npm run build), put it on a test server and give him the domain name. Another possibility is to send him (e.g. via mail, zipped) the content of the dist folder after a build (the index.html and the static folder).
I cloned universal-starter (webpack version) and have it up and running on my local machine using npm start and npm run watch per the instructions
Now stuck after npm run build and attempting to deploy to Azure (and Google Cloud) via the github integration - can't figure out how to set up either to work.
Anyone have a recipe on how to get the webpack bundled files to fire up on an external host with express.js? Do I need to run commands via a CI integration? The files in /dist don't seem to stand on their own.
At Netlify you can connect your git repo and tell them what build commands you want them to use. If you specify the "dist" directory, then they will deploy anything that gets in there (after they have compiled your application).
Edit: the lowest tier is free.
Edit2: I am not associated with Netlify. I just used them in my latest deploy, and found the process extremely easy.
Note: This has changed dramatically since Angular 2. While I'm now moved on to SSR, docker, and all kinds of other things, the simplest answer was to
1) Production build
ng build --prod
2) Transfer files to a static web host (i.e., I used awscli to connect to a s3 bucket when it was just a static site...I know use SSR so I need to use a node server like express)
3) Serve files (there are some complexities for redirect requirements for index.html for error and for 404...and of course setting the status for both redirects to 200)
4) Put something on the frontend for performance/ ssl/ etc. nginx or a CDN would make sense.
I have developed an Angular 2 application using npm, As a fresher,I don't know some ways like below.
When I publish I used npm publish so that it publish the application in npm account in the web.
So here, is there any way to publish our app in the localhost,because I don't want to use npm account and I just need to avoid node_modules folder on publishing ?
If any other way,that can be used to publish the Angular2 Application in local other than npm, let me know.I try that.
If it is not possible to publish the application without npm web account, Kindly let me know please .
Excuse mistakes,If any.Thanks in adv :)
npm publish is to make a library package available to other for free use.
That's not what you use for making a web application available. This is called deployment.
For deployment you usually execute a build step that transpiles TS to JS, and combines them into a single file to reduce the number of requests the browser needs to make in order to get all source files of your application. It may also inline component HTML and CSS. This build step can also minify and mangle to JS code to reduce the resulting file size even more.
The resulting output can just be copied to any directory that any web server is able to serve to a browser either on your local machine or at some machine of a web hosting provider.
There are different ways to build your application depending on your setup.
See for example How to deploy Angular 2 application developed in Typescript to production?
You need browserify, that's all
browsers need references to all js files to be put in the html, they don't understand node's require() method that forms modules dependencies
what browserify does is traversing the entire dependency graph of your project, recursively bundling up all the required modules starting at the given root into a single js file
install it by node package manager
npm install -g browserify
use it to bundle all needed modules staring at main.js
browserify main.js -o bundle.js
now put a single script tag into your html
<script src="bundle.js"></script>
as far as i know, node_modules contains dependencies for typescript transpilers and few others. so it will not be possible to publish an app without using node_modules.
perhaps you can try using Plnkr or jsFiddle
where you can make imports online using cdn links for node_modules and publish your app.
it will be easy compared to other alternatives.
hope this helps.